继承出错
#include<iostream> using namespace std;
#include<string>
class people
{
private:
string name;
int age;
string gender;
public:
pepole(string a,int b,string c)
{
name=a;
age=b;
gender=c;
}
void disp();
};
void people::disp()
{
cout<<"姓名:"<<name<<endl;
cout<<"年龄:"<<age<<endl;
cout<<"性别:"<<gender<<endl;
}
class student:public people{
private:
string number;
public:
student(string a,int b,string c,string d):people(a,b,c)
{
number=d;
}
void disp();
};
void student::disp()
{
people::disp();
cout<<"学号:"<<number<<endl;
}
int main()
{
student stu("张三",14,"男","568974");
stu.disp();
return 0;
}