//Ex6_13.cpp
#include "iostream" 
#include "cstring"
using namespace std;
class Person
{private:
   char name[20];
   char sex;
   int age; 
 public:
   void display()
   {cout<<name<<":"<<sex<<","<<age<<endl;}
	void set(char *n,char s,int a)
	{strcpy(name,n);
     sex=s;
     age=a;}
};
class Student:public Person
{private:
    int id;   
    char classname[10];  
 public:
	void show()
	{cout<<classname<<"-"<<id<<"  ";  
     display();}
	void set(char * c, int i,char *n,char s,int a)
	{strcpy(classname,c); 
     id=i;
     Person::set (n,s,a);   //调用基类同名的成员函数时需指明所属的类
	}
};
void main() 
{Student s; 
 s.set("Math1",89017,"ChengHong",'w',19); 
 s.show(); 
 s.display();  //派生类对象可以直接使用基类的公有成员
}
