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

📄 prog16_06.cpp

📁 c++最经典的入门书籍
💻 CPP
字号:
// Program 16.6 Using an abstract base class  File: prog16_06.cpp
#include <iostream>
#include "Box.h"                                    // For the Box class
#include "ToughPack.h"                              // For the ToughPack class
#include "Carton.h"                                 // For the Carton class
using std::cout;
using std::endl;

int main() {
  cout << endl;

  ToughPack hardcase(20.0, 30.0, 40.0);
  Box* pBox = &hardcase;                            // Store address of ToughPack object
  cout << "Volume of hardcase is " << pBox->volume() << endl;

  Carton aCarton(20.0, 30.0, 40.0);
  pBox = &aCarton;                                  // Store address of a Carton object
  cout << "Volume of aCarton is " << pBox->volume() << endl;

  return 0;
}

⌨️ 快捷键说明

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