Question: This lab has been designed for you to practice implementing and testing overloaded operators for a Rectangle class. The 0 5 _ Rectangle project contains
This lab has been designed for you to practice implementing and testing overloaded operators for a Rectangle class. The Rectangle project contains the following Rectangle class in the "Rectangle. file.
class Rectangle
private:
unsigned width, length;
public:
Rectangle;
Mutator
void setwidthunsigned;
void setLengthunsigned;
Accessor
double area const;
string tostring const;
The width and lengthdata members represent the width and length of a Rectangle shape.
You are given the following member functions:
The default constructor sets the width and length of a new Rectangle object to and respectively.
A setwidth member function that takes one parameter and updates the width of the invoking Rectangle object using the value of the parameter.
A setLength member function that takes one parameter and updates the length of the invoking Rectangle object using the value of the parameter.
An area member function returns the area of the invoking Rectangle object.
A tostring member function returns a string that includes the width and length of the invoking Rectangle object.
In part I, you are asked to overload some operators for the Rectangle class using member functions. Make sure to write their prototypes in the "Rectangle. file, implement them in the "Rectangle.cpp file, and test them in the "main.cpp file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
