INHARIT

Home >> Sem 2 >> C++ programs >> INHARIT

/* Write a program for to implement of inheritance concepts */
#include<iostream.h>
#include<conio.h>
class test
 {
    int a,b;
   public:
    void getdata(int p,int q)
     {
      a = p;
      b = q;
     }
    void show()
     {
        cout<<"A : "<<a<<", B : "<<b<<endl;
     }
  };

 class temp : public test
  {
      int c,d;
     public:
      void get(int t1,int t2)
       {
         c = t1;
         d = t2;
       }
    void disp()
     {
      cout<<"C : "<<c<<" D : "<<d<<endl;
     }
  };


 class ttt : public temp
  {
     int t1 , t2;
     public:
      void getd(int a, int b)
       {
         t1 = a;
         t2 = b;
       }
  };

void main()
 {
   clrscr();
   temp t1;
   t1.getdata(10,15);
   t1.show();
  getch();
 }