#include<iostream.h>
#include<conio.h>
class base
{
int a,b;
public:
void get()
{
cout<<"Enter the two values
of a and b:";
cin>>a>>b;
}
friend float sum(base ob);
};
float sum(base ob)
{
return float(ob.a+ob.b);
}
void main()
{
clrscr();
base obj;
obj.get();
cout<<"\n Sum is : "<<sum(obj);
getch();
}
No comments:
Post a Comment