Add an overloaded assignment operator, a copy constructor to the Cube class, and a printCube member function in the attached lab6_ex2_copy_operator_starter.cpp. This starter is incomplete, you have to fill the right stuff in the blank in order to compile correctly.
This copy constructor should accept a Cube object as an argument. The constructor should assign to the Cube attribute (width, length and height) the value in the arguments Cube attribute. As a result, the new object will be a copy of the argument object.
starter.cpp is
#include
#include
using namespace std;
class Cube
{
private:
int width, length, height;
public:
Cube() {}
Cube(const Cube &c)
{
cout<<"Copy constructor called "<// fill the copy constructor
}
Cube& operator = (const Cube &c)
{
cout<<"Assignment operator called "<// fill the assignment overload operator
}
void Cube printCube()
{
// fill the printCube
}
};
int main()
{
Cube c1, c2;
c2 = c1;
Cube c3 = c1;
c1.printCube();
c2.printCube();
c3.printCube();
getchar();
return 0;
}