#includeusing namespace std; //基类Peopleclass People{public: void setname(char *name); void setage(int age); void sethobby(char *hobby); char *gethobby();protected: char *m_name; int m_age;private: char *m_hobby;};void People::setname(char *name){ m_name = name; }void People::setage(int age){ m_age = age; }void People::sethobby(char *hobby){ m_hobby = hobby; }char *People::gethobby(){ return m_hobby; } //派生类Studentclass Student: public People{public: void setscore(float score);protected: float m_score;};void Student::setscore(float score){ m_score = score; } //派生类Pupilclass Pupil: public Student{public: void setranking(int ranking); void display();private: int m_ranking;};void Pupil::setranking(int ranking){ m_ranking = ranking; }void Pupil::display(){ cout<
void setname(char *name);
void sethobby(char *hobby);
void People::setname(char *name){ m_name = name; }
void People::setage(int age){ m_age = age; }
void People::sethobby(char *hobby){ m_hobby = hobby; }
char *People::gethobby(){ return m_hobby; }
class Student: public People{
void setscore(float score);
void Student::setscore(float score){ m_score = score; }
class Pupil: public Student{
void setranking(int ranking);
void Pupil::setranking(int ranking){ m_ranking = ranking; }