#include<iostream.h>
#include<conio.h>
class demo
{
private:
                int x,y;
public:
                void get()
                                {
                                x=10;
                                y=20;
                                }
                friend void show(demo obj);
};
void show(demo obj)
{
                cout<<"X = "<<obj.x<<endl;
                cout<<"Y = "<<obj.y<<endl;
}
void main()
{
                demo d;
                clrscr();
                d.get();
                show(d);
                getch();
}

152.PNG

Advertisements