#include<iostream.h>
#include<conio.h>
class demo
{
private:
                int x;
                float y;
public:
                void read()
                                {
                                cout<<"Enter Value for X : ";
                                cin>>x;
                                cout<<"Enter Value for Y : ";
                                cin>>y;
                                }
                void display();    //Declaration of Member Function
};
void demo::display()      //Definition Outside The Class
{
                cout<<"\nX = "<<x;
                cout<<"\nY = "<<y;
}
void main()
{
                demo d;
                clrscr();
                d.read();
                d.display();
                getch();
}

143.PNG

Advertisements