Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Human {
  5.  
  6.     public:
  7.    
  8.     virtual void sleep()=0;
  9.     virtual void work() {
  10.         cout<<"I'm working.\n";
  11.        
  12.     }
  13.  
  14. };
  15. class student:public Human{
  16.   public:  
  17.   void sleep(){
  18.       cout<<"I'm sleeping.\n";
  19.      
  20.   }
  21.   void  work(){
  22.       cout<<"I don't like work.\n";
  23.   }
  24. };
  25.  
  26. int main()
  27. {
  28.     student kent;
  29.     kent.sleep();
  30.     kent.work();
  31.    
  32.  
  33.    return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement