gcc warning :[-Wreorder]
gcc version 7.4.0
1.一般情况
https://stackoverflow.com/questions/1564937/gcc-warning-will-be-initialized-after
2.多继承中,基类的构造函数调用
class SingingWaiter : public Singer, public Waiter
{
public:
SingingWaiter()
: Worker(), Waiter(), Singer(){}
......
};
如下警告,
解决办法:保证构造函数与继承的基类顺序相同即可。
class SingingWaiter : public Singer, public Waiter
{
public:
SingingWaiter()
: Worker(), Singer(), Waiter(){}
......
};