5、e1(); virtual Prototype* Clone(); //复制出相同对象的接口};// test.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include "stdlib.h"#include "test.h"using namespace std;///////////////////////////////////////
6、///////////////////////////////////ConCreatePrototype1::ConCreatePrototype1(){ cout << "construction of ConCreatePrototype1";}ConCreatePrototype1::~ConCreatePrototype1(){ cout << "destruction of ConCreatePrototype1";}ConCreatePrototype1::ConCreat
7、ePrototype1(const ConCreatePrototype1&){ cout << "copy a same object as ConCreatePrototype1";}Prototype* ConCreatePrototype1::Clone(){ return new ConCreatePrototype1(*this);}//////////////////////////////////////////////////////////////////////////
8、int main(int argc, char* argv[]){ Prototype* pPrototype = new ConCreatePrototype1; Prototype* pPrototype2 = pPrototype->Clone(); delete pPrototype; delete pPrototype2; system("pause"); r