Answered step by step
Verified Expert Solution
Question
1 Approved Answer
class Square { public : explicit Square ( int Size) : Size (Size} {}; int getSize () const { return Size ; } private :
class Square { public : explicit Square ( int Size) : Size (Size} {}; int getSize () const { return Size ; } private : int Size ; }; 1. void test Square () { 2. Square Si ( 10 ); 3. Square S2 ( 20 ); 4. assert ($1.getSize() * 2 == == S2.getSize()); 5. Square *LargePtr = new Square (100); 6. Square *SmallPtr; 7. assert ($1.getSize() * 10 LargePtr->getSize()); 8. assert (S2.getSize() * 5 == LargePtr.getSize()); 9. SmallPtr &$1; LargePtr- 10. assert (SmallPtr->getSize() * 10 == >getSize()); 11. assert (SmallPtr:getSize() * 10 == LargePtr.getSize () ); 12. assert (SmallPtr Largetr); 13. assert (S1 == *SmallPtr); 14. delete SmallPtr; 15. delete Largeper; 16. delete Sl; 17. delete S2; | 18. } class Square { public : explicit Square ( int Size) : Size (Size} {}; int getSize () const { return Size ; } private : int Size ; }; 1. void test Square () { 2. Square Si ( 10 ); 3. Square S2 ( 20 ); 4. assert ($1.getSize() * 2 == == S2.getSize()); 5. Square *LargePtr = new Square (100); 6. Square *SmallPtr; 7. assert ($1.getSize() * 10 LargePtr->getSize()); 8. assert (S2.getSize() * 5 == LargePtr.getSize()); 9. SmallPtr &$1; LargePtr- 10. assert (SmallPtr->getSize() * 10 == >getSize()); 11. assert (SmallPtr:getSize() * 10 == LargePtr.getSize () ); 12. assert (SmallPtr Largetr); 13. assert (S1 == *SmallPtr); 14. delete SmallPtr; 15. delete Largeper; 16. delete Sl; 17. delete S2; | 18. }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started