5.18
来源:互联网 发布:韩国研究生留学知乎 编辑:程序博客网 时间:2024/06/05 23:50
#include<iostream>
#include<string>
using namespace std;
class person
{
public:
person(string name1,int num1)
{
name=name1;
num=num1;
}
void print()
{
cout<<"姓名:"<<name<<endl;
cout<<"编号:"<<num<<endl;
}
protected:
string name;
int num;
};
class student: public person
{
public:
student(string name1,int num1,string clas1,float score1):
person(name1,num1)
{
clas=clas1;
score=score1;
}
void print()
{
person::print();
cout<<"班级:"<<clas<<endl;
cout<<"成绩:"<<score<<endl;
}
protected:
string clas;
float score;
};
class teacher: public person
{
public:
teacher(string name1,int num1,string job1,string dept1 ):
person(name1,num)
{
job=job1;
dept=dept1;
}
void print()
{
person::print();
cout<<"职称:"<<job<<endl;
cout<<"部门:"<<dept<<endl;
}
protected:
string job;
string dept;
};
int main()
{
student student1("梁文博",201423,"信管1111",99);
cout<<"学生信息:"<<endl;
student1.print();
teacher teacher1("古何凯",1345,"教授","教务处");
cout<<"********************"<<endl;
cout<<"老师信息:"<<endl;
teacher1.print();
return 0;
}
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 5.18
- 2011/5.18
- 5.18作业
- Windows下使用android NDK(JNI)调用OpenCV本地代码——流程梳理
- Spring学习笔记
- 安卓基础 论MediaPlayer的应用(二)
- windos系统快捷键
- UVa10900 - So you want to be a 2n-aire? (期望)
- 5.18
- 黑马程序员-----多线程
- join(inner join)、left join、right join、full join的区别(摘自w3c)
- Message: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could no
- Project Euler Problem 7
- 象观敏捷之旅-初探DDD
- MySQL数据库优化技巧
- POJ 2421 Constructing Roads
- Model与XML互相转换