#include<iostream.h>
#include<conio.h>
class base
{
                int i;
public:
                void show()
                                {
                                i=10;
                                cout<<"I = "<<i<<endl;
                                }
};
class derived:private base
{
private:
                int j;
public:
                derived()
                                {
                                j=20;
                                }
                void display()
                                {
                                show();
                                cout<<"J = "<<j<<endl;
                                }
};
void main()
{
                clrscr();
                derived d;
                d.display();
                getch();
}

190

Advertisements