//this is a program to demonstrate inside class definition
#include<iostream>
#include<conio.h>
using namespace std;
class Sample
{
int x,y;
public:
//Member Function
//Inside calss defination
void display()
{
cout<<"\n\nX: "<<x;
cout<<"\n\nY: "<<y;
}
void accept()
{
cout<<"\n\nEnter any two numbers: ";
cin>>x>>y;
}
};
int main()
{
//Object declaration
Sample s;
//Function Call
s.accept();
s.display();
return 0;
}
#include<iostream>
#include<conio.h>
using namespace std;
class Sample
{
int x,y;
public:
//Member Function
//Inside calss defination
void display()
{
cout<<"\n\nX: "<<x;
cout<<"\n\nY: "<<y;
}
void accept()
{
cout<<"\n\nEnter any two numbers: ";
cin>>x>>y;
}
};
int main()
{
//Object declaration
Sample s;
//Function Call
s.accept();
s.display();
return 0;
}