class two;
class one
{
int a;
public:
one()
{
a = 8;
}
friend two;
};
class two
{
public:
two() { }
two(one i)
{
cout << i.a;
}
};
int main()
{
one o;
two t(o);
getch();
}
我从 Dev-C++ 得到这个错误:
a class-key must be used when declaring a friend
但在使用 Microsoft Visual C++ 编译器编译时运行良好。