#include <bits/stdc++.h>
using namespace std;
class Person
{
public:
void display()
{
cout << "name:" << name << endl;
cout << "age:" << age << endl;
cout << "sex:" << sex << endl;
cout << endl;
}
Person(){
name = "ozzy";
age = 14;
sex = 'M';
}
private:
string name;
int age;
char sex;
};
class Student : public Person
{
public:
void display()
{
cout << "name:" << Person.name << endl;
cout << "age:" << Person.age << endl;
cout << "sex:" << Person.sex << endl;
cout << "num:" << num << endl;
cout << "class:" << Class << endl;
}
Student(){
num = 181154;
Class = 11;
}
private:
int num;
int Class;
};
int main()
{
Person a;
a.display();
return 0;
}
这个哪里错了啊?