prog15_07a.cpp
来自「一本语言类编程书籍」· C++ 代码 · 共 19 行
CPP
19 行
// Program 15.7a Using multiple inheritance. Compilable version!
// File: prog15_07a.cpp
#include <iostream>
#include "CerealPack.h" // For the CerealPack class
using std::cout;
using std::endl;
int main() {
CerealPack packOfFlakes(8.0, 3.0, 10.0, "Cornflakes");
cout << endl;
cout << "packOfFlakes volume is " << packOfFlakes.Carton::volume() << endl;
cout << "packOfFlakes weight is "
<< packOfFlakes.Carton::getWeight()+packOfFlakes.Contents::getWeight()
<< endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?