我有以下代码:
class SomeClass {};
class SomeOtherClass {
SomeClass& someObj;
public:
SomeOtherClass() {someObj = SomeClass();}
};
而且我在构造函数上SomeOtherClass
说Constructor for 'SomeOtherClass' must explicitly initialize the reference member 'someObj'
.
所以我想我的问题很简单。你如何初始化一个引用?