DesignPattern/02.FactoryMethod/2.Code/main.cpp

23 lines
423 B
C++
Raw Normal View History

2019-10-17 23:32:47 +00:00
#include <iostream>
#include "FactoryMethod.h"
int main()
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ\n");
//<2F><><EFBFBD><EFBFBD><E5B9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
AbstractFactory *fac = NULL;
AbstractSportProduct *product = NULL;
fac = new BasketballFactory();
product = fac->getSportProduct();
fac = new FootballFactory();
product = fac->getSportProduct();
fac = new VolleyballFactory();
product = fac->getSportProduct();
system("pause");
return 0;
}