Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class Square { public : explicit Square ( int Size) : Size (Size} {}; int getSize () const { return Size ; } private :

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

Write short notes on Interviews.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago