海南动植物介绍:一道C++程序改错题 高手帮忙啊 我怎么改都不对

来源:百度文库 编辑:神马品牌网 时间:2024/05/03 22:49:27
class one{
private:
int a;
public:
void func(two&);
};
class two{
private:
int b;
friend void one::func(two&);
};
void one::func(two& r)
{
a=r.b;
}

怎么没有main函数啊,那程序要从哪开始啊?

在class one的定义前加上一行声明:
class two;
就行了。