#include<iostream.h>
#include<conio.h>
class normal
{
private:
                int n;
public:
                void read()
                                {
                                n=10;
                                }
                void display()
                                {
                                cout<<"N = "<<n<<endl;
                                }
};
void main()
{
                class local
                {
                private:
                                int l;
                public:
                                void read()
                                                {
                                                l=20;
                                                }
                                void display()
                                                {
                                                cout<<"L = "<<l<<endl;
                                                }
                };
                normal obj1;
                local obj2;
                clrscr();
                obj1.read();
                obj1.display();
                obj2.read();
                obj2.display();
                getch();
}

157.PNG

Advertisements