Question: 9 . 2 3 . 5 : Rearrange the code to implement a class that describes a square with the perimeter as a data member.
: Rearrange the code to implement a class that describes a square with the perimeter as a data member.
Full screen
qxzqy
Repeat the preceding
Repeat the preceding exercise, but with the perimeter, not the side length, as a data member. Here is the revised class definition.
class Square
public:
void setsideint initiallength;
void growint amount;
int getperimeter const;
int getsidelength const;
private:
int perimeter;
;
The interface of the class should be unchanged. Not all lines are useful.
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
