Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class base
  4. {
  5. public:
  6. virtual void display(void)
  7. {
  8. cout << "basen";
  9. }
  10. };
  11.  
  12. class derived : public base
  13. {
  14. public:
  15. void display(void)
  16. {
  17. cout << "derivedn";
  18. }
  19. };
  20. int main(void)
  21. {
  22. base *p;
  23. base ob1;
  24. derived ob2;
  25. p=&ob2;
  26. p->display();//my point starts from here
  27. p->base::display();
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement