#include<iostream.h>
#include<conio.h>
class demo
{
private:
                static int i;
                int j;
public:
                void read()
                                {
                                ++i;
                                cout<<"Enter The Value for J : ";
                                cin>>j;
                                }
                void display()
                                {
                                cout<<"The Value of I = "<<i<<"\tJ = "<<j<<endl;
                                cout<<"The Address of I = "<<(unsigned)&i<<"\tJ = "<<(unsigned)&j<<endl<<endl;
                                }
};
int demo::i=2;
void main()
{
                demo a,b,c;
                clrscr();
                a.read();
                a.display();
                b.read();
                b.display();
                c.read();
                c.display();
                getch();
}

144.PNG

Advertisements