Question: Give the following class: class A { int d{ 4 }; public: int a{ 1 }; display(){cout < < a < < b <

Give the following class:

class A { int d{ 4 }; public: int a{ 1 };

display(){cout << a << b<

1) define a derived class B from the base class A with public inheritance such that it have the following functions:

- private void function show that print the value of a and b;

- public void function display with no argument that prints "my base values are" and then call the display of the base function.

2) in the main function do the following:

define an object of type class A and another object of class B

call display for the first object and the diplay of the second object.

Can you call the function show here? why?

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!