#include
using namespace std;
class CBase
{
public:
virtual void print()
{
cout$amp; }
void DoPrint()
{
print();
}
};
class CChild1: public CBase
{
public:
virtual void print()
{
cout$amp; }
};
class CChild2: pu
{
public:
virtual void pri
{
cout$amp; }
};
void DoPrint(CB
{
base->DoPrint
}
void main()
{
CBase* base =
CChild1* child
CChild2* child
DoPrint(child1
DoPrint(child2
DoPrint(base);
delete base;
base = child1;
base->print();
delete child1;
delete child2;
}
参考答案