///////////////////////////头文件"main.h"////////////其中数据为虚构
#include<iostream>
using namespace std;
class Pet
{
public:
	virtual void life()
	{
		cout<<"Pet"<<endl;
	}
};
class Dog:public Pet
{
public:
	void life()                          //对于虚函数的重写，不需要重复声明virtual
	{
		cout<<"Dog life 13-18"<<endl;
	}
};
class Cat:public Pet
{
public:
	void life()
	{
		cout<<"Cat life 15-20"<<endl;
	}
};
///////////////////////////cpp文件"main.cpp"
#include"main.h"
int main()
{
	Pet* point;
	Pet a;
    Dog b;
	Cat c;
	point=&a;
	point->life();
	point=&b;
	point->life();
	point=&c;
	point->life();
	return 0;
}