Question: Suppose there are four classes: Shape, Rectangle, Triangle, and Circle. All four classes have a virtual function named draw. Shape is an abstract base class,

Suppose there are four classes: Shape, Rectangle, Triangle, and Circle. All four classes have a virtual function named draw. Shape is an abstract base class, and Triangle, Circle, and Rectangle are all non-abstract derived classes that inherit from the Shape class. Suppose the application program has the following statement:
ShapePtr->draw();
Where ShapePtr is a pointer of type Shape*. Assume that we have already set shapePtr to point at something before the shapePtr->draw(); statement.
When the statement ShapePtr->draw(); is executed, the program will choose the correct derived-class function to call based on the pointer type =- not the object type.
We can create Rectangle, Triangle, and Circle objects in the application program.
NOTE: Base class is another term f parent class.
Derived class is another term for child class.
False
True
False
False
True
False
True
True
Suppose there are four classes: Shape, Rectangle,

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 Programming Questions!