Program to Write a Member Function :)
#include<iostream.h>
#include<conio.h>
class add
{
protected:
int m,d;
public:
mahi()
{
m=0;
d=0;
}
read()
{
cout<<"\n Enter a: ";
cin>>m;
cout<<"\n Enter b: ";
cin>>d;
}
showadd()
{
cout<<"\n Addition= "<<m+d;
}
};
void main()
{
clrscr();
add p;
p.mahi();
p.read();
p.showadd();
getch();
}
Here is the Output :))
No comments:
Post a Comment