第十.十一週專案4教師兼幹部類
/*
*Copyright (c) 2016,煙臺大學計算機學院
*All rights reserved.
*檔名稱 :
*作 者 : 劉默涵
*完成日期 : 2016年5月25號
*版 本 號 : v6.0
*
*問題描述 :
*輸入描述 : 無
*程式輸出 :
*/
#include <iostream>
usingnamespace std;
class Teacher
{
protected:
int age;
string name;
string addr;
string title;
string sex;
int tel;
public:
Teacher(int a,string n,string ad,string t,string s,int te);
void display();
};
Teacher::Teacher(int a,string n,string ad,string t,string s,int te)
{
age=a;
name=n;
addr=ad;
title=t;
sex=s;
tel=te;
}
void
{
cout<<"年齡為:"<<age<<endl;
cout<<"姓名為:"<<name<<endl;
cout<<"地址為:"<<addr<<endl;
cout<<"科目為:"<<title<<endl;
cout<<"性別為:"<<sex<<endl;
cout<<"電話為:"<<tel<<endl;
}
class Cadre
{
protected:
int age;
string name;
string addr;
string post;
string sex;
int tel;
public:
Cadre(int a,string n,string ad,string p,string s,int te);
};
Cadre::Cadre(int a,string n,string ad,string p,string s,int te)
{
age=a;
name=n;
addr=ad;
post=p;
sex=s;
tel=te;
}
class Teacher_Cadre:public Teacher,public Cadre
{
private:
double wages;
public:
Teacher_Cadre(int a,string n,string ad,string p,string t,string s,int te,double wa);
void display();
};
Teacher_Cadre::Teacher_Cadre(int a,string n,string ad,string p,string t,string s,int te,double wa):Teacher(a,n,ad,t,s,te),Cadre(a,n,ad,p,s,te),wages(wa){}
void Teacher_Cadre::display()
{
Teacher::display();
cout<<"職務為:"<<post<<endl;
cout<<"佣金為:"<<wages<<endl;
}
int main()
{
Teacher_Cadre f1(27,"Curryons","Los Angeles ","jiaoshi","tiyu","man",1001056985,5000);
f1.display();
}