Answer the following questions for the pxsrogram below:
1 #include
2 using namespace std;
3
4 class Parent
5 {
6 public :
7 void f()
8 {
9 cout <<"invoke f from Parent” << endl;
10 }
11 };
12
13 class Child: public Parent
14 {
15 public :
16 void f()
17 {
18 cout << "invoke f from Child" << endl;
19 }
20 };
21
22 void p(Parent a)
23 {
24 a. f();
25 }
26
27 int main()
28 {
29 Parent a;
30 a. f();
31 p(a);
32
33 Child b;
34 b. f();
35 p(b);
36
37 return 0;
38 }
a. What is the output of this program?
b. What will be the output if line 7 is replaced by virtual void f()?
c. What will be the output if line 7 is replaced by virtual void f() and line 22 is replaced by void p(Parent& a)?
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.