|
#include <iostream>
#include <string>
using namespace std;
class Teacher
{
public:
Teacher(string n,int a,string t) //基类的构造函数
{
name=n;
age=a;
title=t;
}
void display_1();
protected:
string name;
int age;
string title;
};
void Teacher::display_1()
{
cout<<"姓名:"<<name<<endl;
cout<<"年龄:"<<age<<endl;
cout<<"职位:"<<title<<endl;
}
class Student
{
public:
Student(string m,string x,int s)
{
namel=m;
sex=x;
score=s;
}
void display_2();
protected:
string namel;
string sex;
int score;
};
void Student::display_2()
{
cout<<"姓名:"<<namel<<endl;
cout<<"性别:"<<sex<<endl;
cout<<"成绩:"<<score<<endl;
}
class Graduate:public Teacher,public Student //多重继承派生类的构造函数
{
public:
Graduate(string n,int a,string t,string m,string x,int s,string ad):
Teacher(n,a,t),Student(m,x,s),addr(ad){}
private:
string addr;
}
错误就出在这个派生类的构造函数上面~小弟找了一晚上实在不知道哪错了~!!
请各位指点一下小弟~!程序代码可以直接运行,会提示错误,哪个错误的类型小弟也不知道是什么意思~!
52 expected unqualified-id at end of input
52 expected `,' or `;' at end of input |
|