Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 17th, 2010 | Syntax: None | Size: 0.84 KB | Hits: 34 | Expires: Never
Copy text to clipboard
  1. #ifndef VEHICLEH
  2. #define VEHICLEH
  3.  
  4. #include <iostream>
  5. #include <cstdlib>
  6.  
  7. using namespace std;
  8.  
  9. class Vehicle           // base class
  10. {
  11. protected:
  12.    int wheels;          // number of wheels
  13.    float weight;        // unladen weight
  14. public:
  15.    Vehicle(int inwheels, float inweight);  // constructor
  16.    int getwheels(void);         // how many wheels
  17.    float getweight(void);       // how heavy
  18.    void service(void);
  19. };
  20.  
  21. class Car : public Vehicle              // derived class
  22. {
  23.    int numpassengers;                   // number of passengers
  24. public:
  25.    Car(int numwheels, float inweight, int people );
  26.    int getpassengers(void);             // how many passengers
  27.    void service(void);
  28. };
  29.  
  30. class Lorry : public Vehicle
  31. {
  32.  
  33. public:
  34.         Lorry(int numwheels,float inweight,float maxload );
  35.         float getmaxload(void);
  36.         float getloading(void);
  37.         void service(void);
  38. };
  39.  
  40. #endif