标签:ima ESS digital return lang 函数 mat form ios
#include<iostream>
#include<string>
using namespace std;
class Undergraduate
{
public:
int id;
string name;
string profession;
void ShowInfo()
{
cout << "Name:" << name << endl;
cout << "ID:" << id << endl;
cout << "profession:" << profession << endl;
}
};
class Graduate : public Undergraduate
{
public:
int id;
string name;
string profession;
string tutor;
int essay_num;
void ShowInfo()
{
cout << "Name:" << name << endl;
cout << "ID:" << id << endl;
cout << "profession:" << profession << endl;
cout << "tutor:" << tutor << endl;
cout << "Essay Number:" << essay_num << endl;
}
};
void test01()
{
Undergraduate u1;
u1.name="LiJiayan";
u1.id=2019070918;
u1.profession="digital information";
Graduate g1;
g1.name="ZhangBo";
g1.id=1991;
g1.profession="software engineering";
g1.tutor="LiJiayan";
g1.essay_num=100;
u1.ShowInfo();
g1.ShowInfo();
}
int main()
{
test01();
return 0;
}
输出结果:
加油吧!
标签:ima ESS digital return lang 函数 mat form ios
原文地址:https://www.cnblogs.com/lijiayan/p/12919872.html