这个warning是由于初始化顺序引起的,
- // 会出现warning 的代码!
- class cInit
- {
- public:
- cInit(std::string str, int a) : str_(str), a_(a)
- { }
- private:
- int a_;
- std::string str_;
- };
- // OK
- class cInit
- {
- public:
- cInit(std::string str, int a) : str_(str), a_(a)
- { }
- private:
- std::string str_;
- int a_;
- };