相关疑难解决方法(0)

成员初始值设定项不命名非静态数据成员或基类

我很难在Google上找到点击率.

struct a {
    float m_x;
    float m_z;
public:
    a(float x): m_x(x) {}
};

class b : public a {
    b(float z): m_z(z) {}
};
Run Code Online (Sandbox Code Playgroud)

在铿锵3.2:

error: member initializer 'm_z' does not name a non-static data member or base class
    b(float z): m_z(z) {}
Run Code Online (Sandbox Code Playgroud)

c++ clang c++11

40
推荐指数
1
解决办法
4万
查看次数

标签 统计

c++ ×1

c++11 ×1

clang ×1