Files
design-pattern/inc/prototype.hpp
2025-06-02 13:57:29 +08:00

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&); //
};