Multiple inheritance, reference, member function

CSDN Q & A 2022-01-15 02:25:19

Separately declare that Teacher( Teachers' ) Classes and Cadre( Cadres ) class , A new class is derived from these two classes by means of multiple inheritance Teacher_Cadre( Teachers and cadres ) class . requirement :
(1) Include names in both base classes 、 Age 、 Gender 、 Address 、 Telephone and other data members .
(2) stay Teacher Class also contains data members title( The title ), stay Cadre Class also contains data members post( position ). stay Teacher_Cadre Class also contains data members wages( Wages ).
(3) For names in two base classes 、 Age 、 Gender 、 Address 、 Telephone and other data members use the same name , When referring to these data members , Specify scope .
(4)  Declare member functions in the body of the class , Define member functions outside the class .
(5) In derived classes Teacher_Cadre Member function of show Call in Teacher Class display function , Export name 、 Age 、 Gender 、 The title 、 Address 、 Telephone , And then use cout Statement output job and salary .


thank
Similar articles

2022-01-15

2022-01-15

2022-01-15