#include<iostream.h>
#include<conio.h>
class beta;
class alpha
{
private:
int d;
public:
alpha()
{
d = 9;
}
void display_beta(beta b);
friend beta;
};
class beta
{
private:
int d1;
public:
beta()
{
d1 = 10;
}
void display_alpha(alpha a)
{
cout << "\n Data in alpha object a is " << a.d;
}
void square_alpha_data(alpha a)
{
int sq = a.d * a.d;
cout << "\nSquare is : " << sq;
}
friend alpha;
};
void alpha :: display_beta(beta b)
{
cout << "\n Data in alpha object a is " << b.d1;
}
int main(void)
{
alpha a;
beta b;
clrscr();
a.display_beta(b);
b.display_alpha(a);
b.square_alpha_data(a);
getch();
return 0;
}
No comments:
Post a Comment