22 lines
379 B
C++
22 lines
379 B
C++
#pragma once
|
|
#include "common.hpp"
|
|
|
|
class Prototype // C++ 本身的拷贝函数为浅拷贝,原型模式为深拷贝
|
|
{
|
|
public:
|
|
Prototype() {}
|
|
~Prototype() {}
|
|
|
|
virtual Prototype* Clone() = 0;
|
|
};
|
|
|
|
class ConcretePrototype :public Prototype
|
|
{
|
|
public:
|
|
ConcretePrototype() {}
|
|
~ConcretePrototype() {}
|
|
|
|
virtual Prototype* Clone();
|
|
private:
|
|
ConcretePrototype(const ConcretePrototype&); //
|
|
}; |