Project fill in the blanks
I. Questions and codes
#include <iostream> #include <string> using namespace std; Class Person {string name; name int age; Age Public:person () {} void SetName (String na) {Name=na; } void Setage (int a) {age=a; } string GetName () {return name; } int Getage () {return age; } }; Class Leader:public person//(1) {string job; Post string dep; Department Public:leader () {} void Setjob (string jb) {JOB=JB; } void Setdep (char dp[]) {DEP=DP; } string Getjob () {return job; } string Getdep () {return DEP; } }; Class Engineer:public person//(2) {string major; Professional string Prof; Title Public:engineer () {} void Setmajor (String maj) {Major=maj; } void Setprof (String pf) {PROF=PF; } string Getmajor () {return major; } string Getprof () {return prof; } }; Class Chairman:public Leader,public Engineer {private:int C; Public:string name; name int age; Age person () {} void SetName (String na) {Name=na; } void Setage (int a) {age=a; } string GetName () {return name; } int Getage () {return age; }};//(3) int main () {Chairman C; C.setname ("Zhang San"); C.setage (42); C.setjob ("director"); C.SETDEP ("Technical Office"); C.setmajor ("turbine design"); C.setprof ("senior Engineer"); cout <<c.getname () << "," <<c.getage () << "old, served" <<C.GETDEP () <<c. Getjob () <<endl; cout <<c.getprof () << ", engaged in" << c.getmajor () << "professional" << ". "<< Endl; return 0; }
ii. Results of Operation
Third, experience
Iv. Summary of Knowledge points
C + + 5th experiment-Multiple inheritance