【发布时间】:2015-07-14 15:02:34
【问题描述】:
class Example{
public:
friend void Clone::f(Example);
Example(){
x = 10;
}
private:
int x;
};
class Clone{
public:
void f(Example ex){
std::cout << ex.x;
}
};
当我将 f 写为普通函数时,程序编译成功。但是,当我把 f 写成类成员时,就会出现这个错误。
截图:
【问题讨论】:
-
Ehm..... 什么错误?
-
忘记智能感知。您是否真的尝试过编译这个,并在这样做时看到了 first 错误? Is this你真的想做什么?
-
这是我编译程序后的样子:s28.postimg.org/sx85t9lm5/Untitled.png
-
@Khanh 没错,现在看看this is different.