Guest User

Untitled

a guest
Jul 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. //Virtual Function
  2.  
  3. #include <stdio.h>
  4. #include<iostream>
  5. using namespace std;
  6.  
  7. class BasicYes
  8. {
  9. public:
  10. virtual void show() { cout<<" In base class pointer. \n"; }
  11. };
  12.  
  13. class derived: public BasicYes
  14. {
  15. public:
  16.  
  17. void show ()
  18. { cout<< "In derived class" <<endl; }
  19. };
  20.  
  21. int main(void)
  22. {
  23. BasicYes *bp = new derived;
  24. bp->show();
  25. return 0;
  26. }
Add Comment
Please, Sign In to add comment