/*copyright (c) 2016, *all Rights reserved, School of computer and Control engineering, Yantai University. * File name: My.cpp * Author: * Completion date: May 10, 2016 * Problem description:? The teacher (teacher) class and the Cadre (Cadre) class are defined separately, and the new class Teacher_cadre (teacher and cadre) are derived from these two classes by multiple inheritance methods. Requirements: (1) in two base classes include name, age, gender, address, telephone and other data members. (2) The teacher class also contains the data member title (title), which also contains the data member post (title) in the Cadre class, and the data member wages (payroll) in the Teacher_cadre class. (3) The name, age, gender, address, telephone and other data members in the two base classes are given the same name, specifying the scope when referencing the data members. (4) Declare member functions in the class body, and define member functions outside the class. (5) In the member function of the derived class Teacher_cadre, call the display function in the teacher class, output name, age, gender, title, address, phone, and then use the cout statement to output the job and salary. */#include <iostream>using namespace Std;class teacher{protected:string name; int age; string sex; string ADR; int p; String Title;public:teacher (String Nam,int a,string se, string adre,string title_, int num): name (NAM), age (a), sex (SE), a Dr (Adre), title (Title_), p (num) {}; void Show () {cout<< "name:" <<name<< "<<" Age: "<<age<<" << "Sex:" <& lt;sex<< ' << ' adress: ' <<adr<< ' << ' tel-number: ' <<p<< ' <<" Title: "<<title<<"; }};class cadre{protected:string name; int age; string sex; string ADR; String post; int p; Public:cadre (String nam,int A, string se, string adre, int num,string posting): Name (NAM), age (a), sex (SE), ADR (Adre), p (num), post (posting) {}; void Show () {cout<< "post:" <<post<< "; }};class teacher_cadre:public teacher,public cadre{private:double wages; Public:teacher_cadre (String nam,int A, string se,string title, string adre, int num,string posting,double W): Teac Her (nam,a,se,adre,title,num), cadre (nam,a,se,adre,num,posting), Wages (w) {}; void Show () {teacher::show (); Cadre::show (); cout<< "WAGs:" <<wages<<endl; }};int Main () {Teacher_cadre T1 ("Zs", "Femal", "excelent teacher", "Beijing", 121212, "leader", 8888); T1.show (); return 0;}
10th Week Item 4-Teacher and cadre category