Caminhoneiro

c++ abstract

Jan 4th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include<stdio>
  2.  
  3. using namespace std
  4.  
  5. class Car{
  6.  
  7.     public :
  8.         virtual int getNumWheels() = 0;
  9.         virtual int getNumDoors() = 0;
  10.  
  11. };
  12.  
  13. class StationWagon : public Car{
  14.  
  15.     public:
  16.         int getNumWheels() { cout << "Station wagon has 4 wheels" << endl; }
  17.         int getNumDoors() {     cout << "Station wagon has 4 doors" << endl;}
  18.        
  19.         StationWagon() {}
  20.         ~StationWagon();
  21.  
  22. };
  23.  
  24. int main()
  25. {
  26.    
  27.    
  28.  
  29.  
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment