inside declaration of the member function
header files
class addition // class declaration
{
int a,b,c; // data member declaration
public:
void get()
{
cin>> a >> b;
c=a+b;
}
void put()
{
cout<<"Result is C=" << c;
}
};
void main()
{
clrscr();
addition obj;
obj.get(); // object creation
obj.put(); // object calling
getch();
}
Friday, May 1, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment