home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / tutorial / cpptutor / source / vehicle.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-15  |  670 b   |  38 lines

  1.                                // Chapter 7 - Program 2 - VEHICLE.CPP
  2. #include "vehicle.h"
  3.  
  4.  
  5.  
  6.               // initialize to any data desired
  7. void vehicle::initialize(int in_wheels, float in_weight)
  8. {
  9.    wheels = in_wheels;
  10.    weight = in_weight;
  11. }
  12.  
  13.  
  14.               // get the number of wheels of this vehicle
  15. int vehicle::get_wheels()
  16. {
  17.    return wheels;
  18. }
  19.  
  20.  
  21.               // return the weight of this vehicle
  22. float vehicle::get_weight()
  23. {
  24.    return weight;
  25. }
  26.  
  27.  
  28.               // return the weight on each wheel
  29. float vehicle::wheel_loading()
  30. {
  31.    return weight/wheels;
  32. }
  33.  
  34.  
  35. // Result of execution
  36. //
  37. // (This file cannot be executed)
  38.