-->
当前位置:首页 > 题库

PROGRAMMING:A is the virtual base class of A1

Luz5年前 (2021-05-10)题库434
This topic requires reading in three integers a, B and C, and then complete the related design according to the following requirements: 1. Define a base class A, which contains the protected data member int i, design the parametric constructor of class A to initialize I, define the member function display() to display the value of I; 2. Define the public derived class A1 of base class A, and a is the virtual base class of A1; A1 contains the protected data member int j, and designs the constructor of class A1; 3. Define the public derived class A2 of base class A, and a is the virtual base class of A2; A2 contains the protected data member int k, and designs the constructor of class A2; 4. Define class A3, which is a public derived class generated by A1 and A2 in the form of multiple inheritance, and design the constructor of class A3; The member function disp () is defined, where the display () function is called to display the I value, and the output J and K values are also displayed. 5. Define an object variable of class A3 in main(), and create the object by inputting three integers; Call the member function disp() of class A3 to output information.
###Input format:
Enter three integers a, B, and C with absolute values no more than 1000 in one line.
###Output format:
Output the information in the constructor of each class and the member function of the object that is called in the main function.
###Input example:
Here is a set of inputs. For example:
```in
1 2 3
```
###Output example:
The corresponding output is given here. For example:
```out
Call A:i=1
Call A1:i=1
Call A2:i=1
Call A3:i=1
i=1
j=2
k=3
```







answer:If there is no answer, please comment