vehicle.cpp

来自「Since the field of object oriented progr」· C++ 代码 · 共 38 行

CPP
38
字号
                               // Chapter 7 - Program 2 - VEHICLE.CPP
#include "vehicle.h"



              // initialize to any data desired
void vehicle::initialize(int in_wheels, float in_weight)
{
   wheels = in_wheels;
   weight = in_weight;
}


              // get the number of wheels of this vehicle
int vehicle::get_wheels()
{
   return wheels;
}


              // return the weight of this vehicle
float vehicle::get_weight()
{
   return weight;
}


              // return the weight on each wheel
float vehicle::wheel_loading()
{
   return weight/wheels;
}


// Result of execution
//
// (This file cannot be executed)

⌨️ 快捷键说明

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