[Solved]Effort Develop Depth Knowledge Base Class Derived Class Operator Overloading Expand Class Q37227381
In an effort to develop in-depth knowledge of base class,derived class, and operator overloading, we will expand on ourin-class exercise of developing the rectangleType class andoverload the following operators: +, -, *, ++, –, ==, !=,>>, and <<. Your program should contain the followingfeatures:
a. Create a base class named rectangleType with following privatedata members:
• length with double type
• width with double type
b. rectangleType class should contain the followingfunctions:
• 2 constructors (one for default and another to initialize the twoprivate data members mentioned above)
• get methods (getLength() and getWidth()) for each private datamembers
• setDimension() method with two arguments: length and width) toset the private data members
• functions to overload the operators +, -, *, ++, — formanipulation of the private data members.
• functions to overload the operators ==, !=, <=, <, >=,> for comparison of different rectangleType objects
• overload stream insertion and extraction operators in order toprint information out onto the screen
c. Create a derived class named boxType which inherits thefunctionality from based class, rectangleType, but has its own datamember and functions to represent a box.
• height with double type
• 2 constructors (one for default and another to initialize thethree private data members of the base class and the derivedclass)
• get method (getHeight) for the derived class’s data member
• overload the setDimension() method to set the data members of thebase class, rectangleType, as well as its own data member (hint:setDimension(double l, double w, double h) where l=length, w=width,and h=height)
• override the area() method as necessary to work with the derivedclass
• add a new method called volume() to return the volume of the box(using base class’s private data members, length & width, withderived class’s private data member, height)
• functions to overload the operators +, -, *, ++, –, ==, !=,<=, <, >=, > for the derived class
d. Create a caller (where main() is located) file. In this file,create 2 boxType objects and execute all the overloaded operatorsmentioned above. Use the code below:
int main()
{
boxType box1(12, 9, 6);
boxType box2(8, 7, 5);
boxType box3, box4, box5;
cout << “box1: ” << box1 << endl;
cout << “box2: ” << box2 << endl;
box3 = box1 + box2;
cout << “box3: ” << box3 << endl;
box4 = box1 – box2;
cout << “box4: ” << box4 << endl;
box5 = box1 * box2;
cout << “box5: ” << box5 << endl;
if (box1 > box2)
cout << “Volume of box1 is greater than the volume of box2.”<< endl;
else
cout << “Volume of box1 is less than or equal to the volumeof box2.” << endl;
box1++;
cout << “After increment the length, width, and height of”
<< “box1 by one unit, nbox1: “
<< box1 << endl;
box3 = ++box2;
cout << “New dimension of box2: ” << box2 <<endl;
cout << “New dimension of box3: ” << box3 <<endl;
return 0;
}
Expert Answer
Answer to In an effort to develop in-depth knowledge of base class, derived class, and operator overloading, we will expand on our… . . .
OR

