Question: Lab 6: Redesign the Rectangle class with private data members. Since data members are private, in order to access width and height in main program,

Lab 6: Redesign the Rectangle class with private data members. Since data members are private, in order to access width and height in main program, Rectangle class must provide public member methods, as getWidth(), getHeight(), setWidth(), setHeight(), and getArea(). Then create a Rectangle object with default constructor, and later use above set and get methods to adjust width and height, and display the new width, height, and area information on screen.

Lab 6: Redesign the Rectangle class with private data members. Since data

.Lab 6: Redesign the Rectangle class with private data members. Since data members are private, in order to access width and height in main program, Rectangle class must provide public member methods, as getWidth(, getHeight), setWidth(), setHeight(), and getArea(). Then create a Rectangle object with default constructor, and later use above set and get methods to adjust width and height, and display the new width, height, and area information on screen

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!