第十周实验报告2
来源:互联网 发布:一个hdmi网络传输器 编辑:程序博客网 时间:2024/06/03 20:20
#include <iostream>#include <string>using namespace std;class Teacher{public:Teacher( string nam, int ag, char s, string addr, string tel, string ti);void display();~Teacher(){}private:string name;int age;char sex;string address;string tel;string title;};class Cadre{public:Cadre( string nam, int ag, char s, string addr, string tel, string po);void display1();~Cadre(){}protected:string name;int age;char sex;string address;string tel;string post;};class Teacher_Cadre: public Teacher, public Cadre {public:Teacher_Cadre( string nam, int ag, char s, string addr, string tel, string ti, string po, int w):Teacher( nam, ag, s, addr, tel, ti),Cadre( nam, ag, s, addr, tel, po){ wages = w;}void show();~Teacher_Cadre(){}private:int wages;}; Teacher::Teacher( string nam, int ag, char s, string addr, string te, string ti){name = nam;age = ag;sex = s;address = addr; tel = te;title = ti;}void Teacher::display(){cout << "name: " << name << endl; cout << "tellphone: " << tel << endl;cout << "sex: " << sex << endl;cout << "age: " << age << endl;cout << "address: " << address << endl;cout << "title: " << title <<endl;}Cadre::Cadre( string nam, int ag, char s, string addr, string te, string po){name = nam;age = ag;sex = s;address = addr; tel = te;post = po;}void Cadre::display1(){cout << "name: " << name << endl; cout << "tellphone: " << tel << endl;cout << "sex: " << sex << endl;cout << "age: " << age << endl;cout << "address: " << address << endl;cout << "post: " << post <<endl;}void Teacher_Cadre::show(){Teacher::display ();cout << "post: " << post <<endl;cout << "wages: " << wages << endl;}int main(){Teacher_Cadre tc("Wang-li",19,'f',"115 Beijing Road,Shanghai", "12345678902", "teacher", "ksjdbh", 9999);tc.show();system("pause");return 0;}
name: Wang-li
tellphone: 12345678902
sex: f
age: 19
address: 115 Beijing Road,Shanghai
title: teacher
post: ksjdbh
wages: 9999
请按任意键继续. . .
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告2
- 第十周实验报告
- 第十周实验报告
- 第十周实验报告(2)
- 《第十周实验报告任务2》
- 第十周实验报告(2)
- 第十周实验报告(2)
- 【编程语言】C/C++预处理指令
- 程序员应该养成的习惯
- 第十二周任务二
- 第十二周任务三 车
- sql2008读书笔记_T-Sql基本语法
- 第十周实验报告2
- 利用泰森多边形进行面雨量计算
- 预处理指令define
- 一个JS框架D3.js
- 设计模式之装饰模式学习
- MFC中PreTranslateMessage函数浅析
- 基于ExtJS的呼叫中心系统
- 安全测试checklist
- Android培训班(107)start_kernel函数4