Write a C++ program using concept of multi-level inheritance.


SUBMITTED BY: Nrupeshsinh

DATE: June 26, 2016, 4:17 a.m.

FORMAT: C++

SIZE: 399 Bytes

HITS: 459

  1. # include<iostream.h>
  2. # include<conio.h>
  3. class A
  4. {
  5. public:
  6. void show()
  7. {
  8. cout<<"base"<<endl;
  9. }
  10. };
  11. class B : public A
  12. {
  13. public:
  14. void show1()
  15. {
  16. cout<<"Derived from A"<<endl;
  17. }
  18. };
  19. class C : public B
  20. {
  21. public:
  22. void show2()
  23. {
  24. cout<<"Derived from B";
  25. }
  26. };
  27. void main()
  28. {
  29. clrscr();
  30. C obj;
  31. obj.show();
  32. obj.show1();
  33. obj.show2();
  34. getch();
  35. }

comments powered by Disqus