Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Zwierze
  6. {
  7. public:
  8.     virtual void pisz()
  9.     {
  10.         cout << "zwierze" << endl;
  11.     }
  12. };
  13.  
  14. class Wilk:public Zwierze
  15. {
  16. public:
  17.     void pisz()
  18.     {
  19.         cout << "wilk" << endl;
  20.     }
  21. };
  22.  
  23. class Owca:public Zwierze
  24. {
  25.  
  26. };
  27.  
  28. int main()
  29. {
  30.     Zwierze* zwierzeta = new Wilk();
  31.     zwierzeta->pisz();
  32.  
  33.     zwierzeta = new Owca();
  34.     zwierzeta->pisz();
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement