diff --git a/01.SimpleFactory/2.Code/SimpleFactory.h b/01.SimpleFactory/2.Code/SimpleFactory.h index 94b7aa8..26c8969 100644 --- a/01.SimpleFactory/2.Code/SimpleFactory.h +++ b/01.SimpleFactory/2.Code/SimpleFactory.h @@ -5,20 +5,22 @@ #include using namespace std; -//抽象产品类AbstractProduct +//鎶借薄浜у搧绫籄bstractProduct class AbstractSportProduct { public: AbstractSportProduct(){ } - virtual ~AbstractSportProduct(){} - //抽象方法: - virtual void printName(){}; - virtual void play(){}; + virtual ~AbstractSportProduct(){}; + //鎶借薄鏂规硶锛 + // virtual void printName(){}; + virtual void printName() = 0; + // virtual void play(){}; + virtual void play() = 0; }; -//具体产品类Basketball +//鍏蜂綋浜у搧绫籅asketball class Basketball :public AbstractSportProduct { public: @@ -30,7 +32,7 @@ public: { } - //具体实现方法 + //鍏蜂綋瀹炵幇鏂规硶 void printName(){ printf("Jungle get Basketball\n"); } @@ -39,7 +41,7 @@ public: } }; -//具体产品类Football +//鍏蜂綋浜у搧绫籉ootball class Football :public AbstractSportProduct { public: @@ -51,7 +53,7 @@ public: { } - //具体实现方法 + //鍏蜂綋瀹炵幇鏂规硶 void printName(){ printf("Jungle get Football\n"); } @@ -60,7 +62,7 @@ public: } }; -//具体产品类Volleyball +//鍏蜂綋浜у搧绫籚olleyball class Volleyball :public AbstractSportProduct { public: @@ -72,7 +74,7 @@ public: { } - //具体实现方法 + //鍏蜂綋瀹炵幇鏂规硶 void printName(){ printf("Jungle get Volleyball\n"); }