can.cpp

来自「一本语言类编程书籍」· C++ 代码 · 共 14 行

CPP
14
字号
// Can.cpp
#include "Can.h"

Can::Can(double canDiameter, double canHeight) :
                                      diameter(canDiameter), height(canHeight) {}

// Function to calculate the volume of a Can object
double Can::volume() const {
  return pi * diameter * diameter * height / 4;
}

// Definitions for the Can class
const double Can::pi = 3.14159265;                  // Initialize static member

⌨️ 快捷键说明

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