#include<iostream>
#include<string>
//纯虚函数用来定义抽象类 继承的子类必须全部实现纯虚函数,否则,继承的子类也是抽象类,无法创建对象
//声明:virtaul 返回值类型 函数名(参数表)=0;
using namespace std;
class People{
public:
string name;
string sex;
int age;
virtual string getName()=0;
virtual string getSex()=0;
virtual int getAge()=0;
};
class Student:public People{
public:
Student(string name,string sex,int age){
this->name=name;
this->sex=sex;
this->age=age;
}
string getName(){
return name;
}
string getSex(){
return sex;
}
int getAge(){
return age;
}
};
int main(){
Student s("fenglei","man",12);
cout<<s.getName()<<endl;
return 0;
}