⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 carfactory.cpp

📁 C++高级编程这本书所附的源代码
💻 CPP
字号:
/**
 * CarFactory.cpp
 */

#include "CarFactory.h"

// Initialize the count to zero when the factory is created.
CarFactory::CarFactory() : mNumCarsInProduction(0) {}

// Increment the number of cars in production and return the 
// new car.
Car* CarFactory::requestCar()
{
  mNumCarsInProduction++;
  return createCar();
}

int CarFactory::getNumCarsInProduction() const
{
  return mNumCarsInProduction;
}

Car* FordFactory::createCar()
{
  return new Ford();
}

Car* ToyotaFactory::createCar()
{
  return new Toyota();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -