#include #include "FactoryMethod.h" #include int main() { printf("工厂方法模式\n"); //定义工厂类对象和产品类对象 std::shared_ptr fac = make_shared(); std::shared_ptr product = std::shared_ptr(fac->getSportProduct()); fac = make_shared(); // product = std::shared_ptr(fac->getSportProduct()); product = std::shared_ptr(fac->getSportProduct()); fac = make_shared(); product = std::shared_ptr(fac->getSportProduct()); system("pause"); return 0; }