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 nonabstract derived classes that inherit from the Shape class. Suppose the application program has the following statement:
ShapePtrdraw;
Where ShapePtr is a pointer of type Shape Assume that we have already set shapePtr to point at something before the shapePtrdraw; statement.
When the statement ShapePtrdraw; is executed, the program will choose the correct derivedclass 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
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
