Untitled
unknown
plain_text
a year ago
485 B
8
Indexable
#include<iostream>
using namespace std;
class first;
class second
{
private:int s;
public:void get()
{
cout<<"enter a number:";
cin>>s;
}
friend void sum(second,first);
}
class first
{
private:int f;
public:void get()
{
cout<<"enter a number:";
cin>>f;
}
friend void sum(second,first);
}
void sum(second s1,first f1)
{
cout<<"\nsum="<<s.s+f.f;
}
int main()
{
first f1;
second s1;
f1.get();
s1.get();
sum(s1,f1);
return 0;
}Editor is loading...
Leave a Comment