Question: Create two objects: a rectangle and a square. Also, create a rectangle pointer named rptr and initialize it to nullptr. Then: point the rptr pointer
Create two objects: a rectangle and a square. Also, create a rectangle pointer named rptr and initialize it to nullptr. Then:
- point the rptr pointer to the rectangle object and use it to call the getName() function.
- point the rptr pointer to the square object and use it to call the getName() function.
Step by Step Solution
3.50 Rating (150 Votes )
There are 3 Steps involved in it
To achieve this you would need to have a class hierarchy where both the Rectangle and Square classes ... View full answer
Get step-by-step solutions from verified subject matter experts
