Initialization of reference member requires a temporary variable C++

后端 未结 12 1898
自闭症患者
自闭症患者 2020-12-10 03:29
struct Div
{
   int i;
   int j;
};   

class A
{
    public:
             A();
             Div& divs;
};

In my constructor definition, I have

12条回答
  •  我在风中等你
    2020-12-10 04:12

    For one, you can't have a NULL reference. As second, all variable references in a class must be initialized at construction time.

提交回复
热议问题