#include<iostream.h>
#include<conio.h>
class first;
class second
{
int a;
public:
second()
{
a=3;
}
friend void sum(first , second );
};
class first
{
int b;
public:
first()
{
b=10;
}
friend void sum(first ,second );
};
void sum(first fobj, second sobj)
{
int s;
s= fobj.b + sobj.a;
cout<<"\n Sum is "<<s;
}
void main()
{
clrscr();
first f;
second s;
sum(f,s);
getch();
}
#include<conio.h>
class first;
class second
{
int a;
public:
second()
{
a=3;
}
friend void sum(first , second );
};
class first
{
int b;
public:
first()
{
b=10;
}
friend void sum(first ,second );
};
void sum(first fobj, second sobj)
{
int s;
s= fobj.b + sobj.a;
cout<<"\n Sum is "<<s;
}
void main()
{
clrscr();
first f;
second s;
sum(f,s);
getch();
}
No comments:
Post a Comment