From 858356d5080fc2c4a7c2bc6d24173aae44c9e984 Mon Sep 17 00:00:00 2001 From: a7458969 <290198252@qq.com> Date: Mon, 18 May 2020 21:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0prototype=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 33 ++++++++++++++++++--------------- general/src/pattern/factory.hpp | 12 +++++++++--- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4129c36..9dc000d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -20,8 +20,7 @@ - - + @@ -86,21 +85,24 @@ - - + + + + + - - - - - - - - @@ -174,12 +176,13 @@ - + + - diff --git a/general/src/pattern/factory.hpp b/general/src/pattern/factory.hpp index aeb07c4..8a6ce5c 100644 --- a/general/src/pattern/factory.hpp +++ b/general/src/pattern/factory.hpp @@ -13,18 +13,24 @@ public: return nullptr; } }; +template +class CloneAble{ +public: + virtual T* Clone(){ + } +} template class Prototype{ public: - Prototype(T ){ + Prototype(CloneAble *){ } virtual T*GetProduct(){ - + return mProto->Clone(); } private: - T *mProto; + CloneAble *mProto; Prototype(){} }; #endif //GENERAL_FACTORY_HPP