#include <iostream>
using namespace std;
class Student
{
private:
	int num;                                   //在基类中定义数据成员num
public:
	void display()
	{
		cout<<"num: "<<num<<endl;
	}
};
class NewStudent:public Student                   //建立派生类NewStudent
{
private:
	int age;                                   
public:
	int num;                                  //将基类中的数据成员num覆盖
	void new_display()
	{
	cout<<"age: "<<age<<endl;
	}
};
int main()
{
	NewStudent t;                              //建立派生类的对象t
	t.num=1;                                  //为覆盖后的数据成员赋值
	cout<<"覆盖后的数据成员num: "<<t.num<<endl;
	return 0;
}


