Question: Could you please write this in C++ In this exercise, first redefine the class rectangleType by declaring the instance variable as protected and then overload

Could you please write this in C++

Could you please write this in C++ In this exercise, first redefine

In this exercise, first redefine the class rectangleType by declaring the instance variable as protected and then overload additional operators as defined in parts A through C. A. Overload the pre- and post- increment and decrement operators to increment and decrement, respectively, the length and width of a rectangle by one unit. (Note that after decrementing the length and width, they must be positive.) B. Overload the binary operator - to subtract the dimensions of one rectangle from the corresponding dimensions of another rectangle. If the resulting dimensions are not positive, output an appropriate message and do not perform the operation. C. The operators == and != are overloaded by considering the lengths and widths of rectangles. Redefine the functions to overload the relational operator by considering the areas of rectangles as follows: two rectangles are the same, if they have the same area; otherwise, the rectangles are not the same. Similarly, rectangle yard1 is greater than rectangle yard 2 if the area of yard1 is greater than the area of yard2. Overload the remaining relational operators using similar definitions. D. Write the definitions of the functions to overload the operators defined in parts A through C. E. Write a test program that tests various operations on the class rectangletype

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!