SIGN IN SIGN UP
huihut / interview UNCLAIMED

📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.

0 0 13 C++
//
// Created by xiemenghui on 2018/7/20.
//
#include "Factory.h"
#include "product.h"
#include "FactoryMain.h"
#include <iostream>
using namespace std;
void FactoryMain()
{
// Benz
Factory * pFactory = Factory::CreateFactory(Factory::FACTORY_TYPE::BENZ_FACTORY);
ICar * pCar = pFactory->CreateCar();
IBike * pBike = pFactory->CreateBike();
cout << "Benz factory - Car: " << pCar->Name() << endl;
cout << "Benz factory - Bike: " << pBike->Name() << endl;
SAFE_DELETE(pCar);
SAFE_DELETE(pBike);
SAFE_DELETE(pFactory);
// BMW
pFactory = Factory::CreateFactory(Factory::FACTORY_TYPE::BMW_FACTORY);
pCar = pFactory->CreateCar();
pBike = pFactory->CreateBike();
cout << "Bmw factory - Car: " << pCar->Name() << endl;
cout << "Bmw factory - Bike: " << pBike->Name() << endl;
SAFE_DELETE(pCar);
SAFE_DELETE(pBike);
SAFE_DELETE(pFactory);
// Audi
pFactory = Factory::CreateFactory(Factory::FACTORY_TYPE::AUDI_FACTORY);
pCar = pFactory->CreateCar();
pBike = pFactory->CreateBike();
cout << "Audi factory - Car: " << pCar->Name() << endl;
cout << "Audi factory - Bike: " << pBike->Name() << endl;
SAFE_DELETE(pCar);
SAFE_DELETE(pBike);
SAFE_DELETE(pFactory);
}