#include<iostream.h>
#include<conio.h>
class base1
{
public:
                int b1;
};
class base2:public base1
{
public:
                int b2;
};
class base3:protected base2
{
protected:
                int b3;
public:
                void get()
                                {
                                b1=10;
                                b2=20;
                                b3=30;
                                }
                void display()
                                {
                                cout<<"B1 = "<<b1<<"\nB2 = "<<b2<<"\nB3 = "<<b3<<endl;
                                }
};
void main()
{
                clrscr();
                base3 obj;
                obj.get();
                obj.display();
                getch();
}

192

Advertisements