码迷,mamicode.com
首页 > 其他好文 > 详细

第12周——教师干部类

时间:2014-05-15 14:41:33      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:blog   class   code   c   ext   http   

#include <iostream>

using namespace std;

class Teacher
{
    public:
    Teacher(string nam,int ag,string add,string tel,string se,string ti):
    name(nam),age(ag),addr(add),telnum(tel),sex(se),title(ti){}
    protected:
    int age;
    string addr,sex,title,name,telnum;
};
class Cadre
{
    public:
    Cadre(string nam,int ag,string add,string tel,string se,string po):
    name(nam),age(ag),addr(add),telnum(tel),sex(se),post(po){}
    void display ();
    protected:
    int age;
    string addr,sex,name,telnum,post;
};
class Cadre_Teacher:public Teacher ,public Cadre
{
    public:
    Cadre_Teacher (string nam,int ag,string add,string tel,string se,string po,string ti,double w):
    Cadre(nam,ag,add,tel,se,po),Teacher(nam,ag,add,tel,se,ti),wages(w){}
    void show();
    protected:
    double wages;
};
void Cadre::display()
{
    cout<<"name:"<<name<<endl;
    cout<<"age:"<<age<<endl;
    cout<<"tel:"<<telnum<<endl;
    cout<<"sex:"<<sex<<endl;
    cout<<"post:"<<post<<endl;
}
void Cadre_Teacher::show ()
{
    Cadre::display();
    cout<<"title:"<<title<<endl;
    cout<<"salary:"<<wages<<endl;
}
int main()
{
    Cadre_Teacher C1("shanhongyu",19,"YantaiUnversity","1886555XXXX","man","freshman","stu",100);
    C1.show();
    return 0;
}
bubuko.com,布布扣

第12周——教师干部类,布布扣,bubuko.com

第12周——教师干部类

标签:blog   class   code   c   ext   http   

原文地址:http://blog.csdn.net/u012313437/article/details/25703773

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!