#include <iostream>
#include <string>
using namespace std;
class Student                                    //定义类Student
{
protected:
	int num;
	string name;
	char sex;
public:
	void display();                               //声明输出函数
	Student(int n,string n1,char s);                  //声明构造函数
};
void Student::display()                             //定义输出函数
{
	cout<<"num: "<<num<<endl;
	cout<<"name: "<<name<<endl;
	cout<<"sex: "<<sex<<endl;
}
Student::Student(int n,string n1,char s)                //定义构造函数
{
	num=n;
	name=n1;
	sex=s;
}
class NewStudent                                 //定义类NewStudent
{
protected:
	string name1;
	int age;
public:
	void display1();                              //声明输出函数
	NewStudent(string n2,int a);                    //声明构造函数
};
void NewStudent::display1()                        //定义输出函数
{
	cout<<"name: "<<name1<<endl;
	cout<<"age: "<<age<<endl;
}
NewStudent::NewStudent(string n2,int a)              //定义构造函数
{
	name1=n2;
	age=a;
}
class Graduate:public Student,public NewStudent      //建立多继承派生类
{
private:
	string addr;
public:
	void display2();                            //声明输出函数
	Graduate(int n,string n1,char s,int a,string a1);    //声明派生类构造函数
};
void Graduate::display2()                         //定义输出函数
{
	cout<<"num: "<<num<<endl;
	cout<<"name: "<<name<<endl;
	cout<<"sex: "<<sex<<endl;
	cout<<"age: "<<age<<endl;
	cout<<"addr: "<<addr<<endl;
}
Graduate::Graduate(int n,string n1,char s,int a,string a1):Student(n,n1,s),NewStudent(n1,a)
                                              //定义多继承构造函数
{
	addr=a1;
}
int main()
{
	Graduate t(2010,"zhangsan",'m',19,"address");    //建立对象t，并赋值 
	t.display2();                               //调用输出函数
	return 0;
}

