01.//02.* Copyright (c) 2013, 烟台大学计算机学院
02.//04.* 作 者: 马德鹏
03.//05.* 完成日期:2014 年 6 月 19 日
04.//06.* 版 本 号:v1.0
05.//07.*
#include <iostream>
using namespace std;
class Student
{
public:
void get_value()
{
cin>>num>>name>>sex;
}
void display( )
{
cout<<"num: "<<num<<endl;
cout<<"name: "<<name<<endl;
cout<<"sex: "<<sex<<endl;
}
private :
int num;
string name;
char sex;
};
class Student1:public Student
{
public:
void get_value1()
{
get_value();
cin>>age>>addr;
}
void display1()
{
display();
cout<<"age: "<<age<<endl;
cout<<"address: "<<addr<<endl;
}
private:
int age;
string addr;
};
//主函数已给定如下,提交时不需要包含,会自动添加到程序尾部
int main()
{
Student1 stud1;
stud1.get_value1();
stud1.display1();
return 0;
}