第五章作业5.18
来源:互联网 发布:北大青鸟编程调试软件 编辑:程序博客网 时间:2024/06/05 06:52
#include<iostream>#include<string>
using namespace std;
class person{
public:
person(int number,string name)//构造函数
{
number=number1;
name=name1;
}
void print()
{
cout<<"number"<<number<<endl;
cout<<"name"<<name<<endl;
}
private:
int number;//编号
string name;//姓名
};
class teacher: public person{
public:
teacher(int number,string name,string work,string company)://构造函数
person(number,name)
{
work=work1;//职称
company=company1//部门
}
void print()
{
person::print();
cout<<"职称"<<work<<endl;
cout<<"部门"<<company<<endl;
private:
string work;
string company;
};
class student:public person{//声明类person是类student的虚基类
public:
student(int number,string name,int classes,float score):
person(number,name)
{
classes=classes1;
score=scpre1;
}
void print()
{
person::print();
cout<<"班级"<<classes<<endl;
cout<<"分数"<<score<<endl;
private:
int classes;//班号
float score;//分数
};
int main()
{
teacher teacher1('1',"xiaoming","教师","baidu")
cout<<"老师:"<<endl;
teacher1.print();
student student1('1',"xiaohong",'1','99')
student1.print;
return 0;
}
0 0
- 第五章作业5.18
- 第五章:作业
- 第五章:作业
- 第五章作业。
- 第五章实验作业
- 第五章作业
- 第五章作业
- 第五章作业
- 第五章作业
- 第五章作业part1
- 第五章作业
- 第五章作业
- 第五章作业
- 第五章作业
- 第五章作业二
- 第五章作业一
- 第五章作业
- 第五章作业
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- CSUOJ 1600 Twenty-four point (判断24点,另附给出表达式版)
- LeetCode 7 Reverse Integer(C,C++,Java,Python)
- (转) C++ 静态成员和函数的总结(不知道原创在哪里=。=)
- Spring ApplicationContext配置文件的路径配置方式
- 第五章作业5.18
- iOS 禁止横屏
- 阅读笔记——基于字典学习的图像分类方法总结
- 4.17
- Linux makefile 教程 非常详细,且易懂
- Wdatepicker日期控件的使用指南
- ZOJ2105——Number Sequence
- mysql怎么root密码
- 创建数据库