Question: Please provide .h and .cpp Exercise 3. The following exercises refer to the rectangle class Rect declaration in the header file shown below. class Rect
Please provide .h and .cpp
Exercise 3. The following exercises refer to the rectangle class Rect declaration in the header file shown below. class Rect public: Rect(int len, int wid); int GetArea(); // return the area of the rectangle 1/ space for adding new member functions private: int length; int width; (a) Define the constructor Rect(int len, int wid); in the implementation file. (b) Write the implementation for member function int GetArea () (e) Declare and implement a new method (function member) bool isItASquare () to check if the Rect object is a square. (d) Declare and implement a new method (function member) void display (ostream& out) const so that it can be used to print a Rect object in the format [length, width). For example: Rect r(5, 3); r.display (cout); // it should print the Rect r as [5, 3] on the screen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
