#include #include #include "SimpleFactory.h" int main() { printf("简单工厂模式\n"); //定义工厂类对象 std::shared_ptr fac = std::make_shared(); std::shared_ptrproduct = std::shared_ptr(fac->getSportProduct("Basketball")); fac = std::make_shared(); product = std::shared_ptr(fac->getSportProduct("Football")); fac = std::make_shared(); product = std::shared_ptr(fac->getSportProduct("Volleyball")); #ifdef win32 system("pause"); #endif return 0; }