编程知识 cdmana.com

Multiple inheritance, reference, member function

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 .

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/12/20211207162230329a.html

Scroll to Top