#include <iostream.h>
#include <conio.h>
class demo
{
int no;
public:
void input()
{
cin>>no;
}
void display()
{
cout<<no;
}
};
void main()
{
clrscr();
demo obj;
demo *ptr=&obj;
cout<<"\nEnter a number : ";
ptr->input();
cout<<"\nNumber entered : ";
ptr->display();
getch();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.