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

📄 box.h

📁 Visual C++ 2005的源代码
💻 H
字号:
// Box.h for Ex9_10
#pragma once
#include "Container.h"                 // For CContainer definition
#include <iostream>
using std::cout;
using std::endl;

class CBox: public CContainer          // Derived class
{
  public:

    // Function to show the volume of an object
    virtual void ShowVolume() const
    {
      cout << endl
           << "CBox usable volume is " << Volume(); 
    }

    // Function to calculate the volume of a CBox object
    virtual double Volume() const
    { return m_Length*m_Width*m_Height; }

    // Constructor
    CBox(double lv = 1.0, double wv = 1.0, double hv = 1.0)
                             :m_Length(lv), m_Width(wv), m_Height(hv){}

  protected:
    double m_Length;
    double m_Width;
    double m_Height;
};

⌨️ 快捷键说明

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