diff --git a/04.BuilderPattern/2.Code/BuilderPattern.h b/04.BuilderPattern/2.Code/BuilderPattern.h index bb4452c..60a015a 100644 --- a/04.BuilderPattern/2.Code/BuilderPattern.h +++ b/04.BuilderPattern/2.Code/BuilderPattern.h @@ -134,6 +134,8 @@ public: builder = nullptr; } } + Director(const Director&) = delete; + Director& operator=(const Director&) = delete; // 具体实现方法 void setBuilder(AbstractBuilder *iBuilder) { this->builder = iBuilder; diff --git a/21.StatePattern/2.Code/GameAccount.h b/21.StatePattern/2.Code/GameAccount.h index 0d48022..b2283f4 100644 --- a/21.StatePattern/2.Code/GameAccount.h +++ b/21.StatePattern/2.Code/GameAccount.h @@ -11,6 +11,14 @@ class GameAccount public: GameAccount(); GameAccount(string iName); + GameAccount(const GameAccount&) = delete; + GameAccount& operator=(const GameAccount&) = delete; + ~GameAccount(){ + if(level){ + delete level; + level = nullptr; + } + } string getName(); void win(); void lose();