3. (Constructor 15 Points) We declare the following class, where the constructor
ID: 3704794 • Letter: 3
Question
3. (Constructor 15 Points) We declare the following class, where the constructors are missing. Please add the following three constructors in the rectangle class and implement the constructors. .The first constructor takes no input parameters. The height and width are set to 3 and 4, respectively member is set to height value; the width member is set to 4 class rectangle int height; int width; // A simple class public: // the first constuctor, // the second constuctor, // the third constuctor rectangle (void) // this is a destructorExplanation / Answer
class rectangle { int height; int width; public: rectangle(); rectangle(int height_value); rectangle(int height_value, int width_value); ~rectangle(); }; rectangle::rectangle() { height = 3; width = 4; } rectangle::rectangle(int height_value) { height = height_value; width = 4; } rectangle::rectangle(int height_value, int width_value) { height = height_value; width = width_value; } rectangle::~rectangle() { }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.