#pragma once
class IAnimal
{
public:
IAnimal(void);
~IAnimal(void);
public:
virtual void ShowMsg() = 0;
};
#include "IAnimal.h"
IAnimal::IAnimal(void)
{
}
IAnimal::~IAnimal(void)
{
}
#pragma once
#include "people.h"
class CManager :public CPeople
{
public:
CManager(void);
~CManager(void);
public:
void ShowMsg();
};
#include "Manager.h"
#include <iostream>
using namespace std;
CManager::CManager(void)
{
}
CManager::~CManager(void)
{
}
void CManager::ShowMsg()
{
cout << "Manager ShowMsg" << endl;
}
#include "People.h"
#include "IAnimal.h"
#include "Manager.h"
#include <iostream>
using namespace std;;
void main()
{
IAnimal *pPeople = NULL;
CPeople p = CPeople();
pPeople = &p;
pPeople->ShowMsg(); //输出People ShowMsg
IAnimal *pManager = new CManager();
pManager->ShowMsg();//输出Manager ShowMsg
int wait ;
cin >> wait;
}