Bog*_*hai 0 c++ oop const reference
我有两个关于以下代码的问题.
class cls{
int vi;
public:
cls(int v=37) { vi=v; }
friend int& f(cls);
};
int& f(cls c) { return c.vi; }
int main(){
const cls d(15);
f(d)=8;
cout<<f(d);
return 0;
}
Run Code Online (Sandbox Code Playgroud)