各位大师,看看错在哪
#include<iostream>using namespace std;
class person{
public:
person(int number1,string name1)
{number=number1;
name=name1;}
void print()
{cout<<"编号:"<<number<<endl;
cout<<"姓名:"<<name<<endl;
}
protected:
long number;
string name;
};
class student:virtual public person{
public:
student(int number1,string name1,int class_number1,float score1):person(number1,name1)
{class_number=class_number1;
score=score1;}
void print()
{person::print()
cout<<"班号:"<<class_number<<endl;
cout<<"成绩:"<<score<<endl;}
protected:
int class_number;
float score;};
class teacher:virtual public person{
public:
teacher(int number1,string name1,srting work1,string dept1):person(number1,name1)
{work=work1;
dept=dept1;}
void print()
{person::print();
cout<<"职称:"<<work<<endl;
cout<<"部门:"<<dept<<enddl;}
protected:
string work;
string dept;};
int main()
{student stud1(12115021058,"张三",12,89);
cout<<"学生:"<<endl;
stud1.print();
teacher stud2(12115021059,"李四","老师","英语系");
cout<<"老师:"<<endl;
stud2.print();
return 0;}