11.7 ༶Ĺ캯
#include <iostream>
#include<string>
using namespace std;
class Student//
 {public:                                  //ò
   Student(int n, string nam )            //๹캯
    {num=n;
     name=nam;
    }
   void display( )                           //ݳԱ
    {cout<<num:<<num<<endl;
     cout<<name:<<name<<endl;
    }
  protected:                                //
    int num;                                //ݳԱ
    string name;
};

class Student1: public Student               //Student1
 {public:
   Student1(int n,char nam[10],int a):Student(n,nam)//๹캯
    {age=a; }                         //ڴ˴ֻݳԱʼ
   void show( )                               //numnameage
    {display( );                               //numname
     cout<<age: <<age<<endl;
    }
   private:                                   //˽
    int age;                                  //һݳԱ
  };

class Student2:public Student1               //ӹStudent2
 {public:
   //Ǽ๹캯
   Student2(int n, string nam,int a,int s):Student1(n,nam,a)
{score=s;}
   void show_all( )                              //ȫݳԱ
{show( );                                    //numname 
     cout<<score:<<score<<endl;               //age
    }
  private:
   int score;                                   //һݳԱ
 };

int main( )
 {Student2 stud(10010,Li,17,89);
  stud.show_all( );                            //ѧȫ
return 0;
 }