In this question, I'm supposed to create 2 base classes A
and B
. Each of which contains a display function. There are 2 int inputs taken, the first one gets square and we find the root of the second. How do I code this in C++ ?
The question is :
- Create a base class
A
and it contains a member functiondisplay()
to calculate the square of a number and display it. - Create a base class
B
and it contains a member functiondisplay()
to calculate the square root of a number and display it. - Create a class named
C
derived fromA
andB
. Declare the object for classC
and call thedisplay
functions of ClassA
andB
from the main function to display the result.