#if 1
#include<iostream>
#include<string>
using namespace std;
class student
{
public:
student(string name, int ID, char sex, int age)
{
this->name = name;
this->ID = ID;
this->sex = sex;
this->age = age;
}
~student(){}
void showinfo()
{
cout << "姓名:" << name << endl;
cout << "学号:" << ID << endl;
cout << "性别:" << sex << endl;
cout << "年龄:" << age << endl;
}
private:
string name;
int ID;
char sex;
int age;
};
class hightschool :public student
{
public:
hightschool(string name,int ID,char sex,int age,string major):student(name,ID,sex,age)
{
this->major = major;
}
void schoolmoney()
{
cout << "获得奖学金" << endl;
}
private:
string major;
};
class graduate:public student
{
public:
graduate(string name, int ID, char sex, int age, string teachername, string major1) :student(name, ID, sex, age)
{
this->teachername = teachername;
this->major1 = major1;
}
void gongzi()
{
cout << "发放工资函数" << endl;
}
private:
string teachername;
string major1;
};
int main()
{
student d1("aaa",001,"x",15);//这里的"aaa”报错,说是类型不符
}
#endif