carton.h

来自「一本语言类编程书籍」· C头文件 代码 · 共 23 行

H
23
字号
// Carton.h - defines the Carton class with the Box class as base
#ifndef CARTON_H
#define CARTON_H 
#include "Box.h"                                // For Box class definition

class Carton : public Box {
  public:
    // Constructor which can also act as default constructor - calls default base constructor automatically
    Carton(const char* pStr = "Cardboard");
    
    // Constructor explicitly calling the base constructor
    Carton(double lv, double wv, double hv, const char* pStr = "Cardboard");
   Carton(const Carton& aCarton);                // Copy constructor   
    ~Carton();                                  // Destructor

    // Function to calculate the volume of a Carton object
    double volume() const;

  protected:
    char* pMaterial;
};
#endif 

⌨️ 快捷键说明

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