adjust format

master
FengJungle 2021-09-09 22:26:43 +08:00
parent 687fcf5cb6
commit 875e2b2bfc
1 changed files with 14 additions and 14 deletions

View File

@ -39,7 +39,7 @@ public:
AbstractSportProduct(){
}
virtual ~AbstractSportProduct(){}
virtual ~AbstractSportProduct(){}
//抽象方法:
virtual void printName() = 0;
virtual void play(){} = 0;
@ -107,7 +107,7 @@ class AbstractFactory
{
public:
virtual AbstractSportProduct *getSportProduct() = 0;
virtual ~AbstractFactory(){}
virtual ~AbstractFactory(){}
};
```
@ -166,24 +166,24 @@ int main()
fac = new BasketballFactory();
product = fac->getSportProduct();
delete fac;
fac = nullptr;
delete product;
product = nullptr;
delete fac;
fac = nullptr;
delete product;
product = nullptr;
fac = new FootballFactory();
product = fac->getSportProduct();
delete fac;
fac = nullptr;
delete product;
product = nullptr;
delete fac;
fac = nullptr;
delete product;
product = nullptr;
fac = new VolleyballFactory();
product = fac->getSportProduct();
delete fac;
fac = nullptr;
delete product;
product = nullptr;
delete fac;
fac = nullptr;
delete product;
product = nullptr;
system("pause");
return 0;