Why should I prefer to use member initialization lists?

后端 未结 9 1257
醉酒成梦
醉酒成梦 2020-11-21 04:43

I\'m partial to using member initialization lists with my constructors... but I\'ve long since forgotten the reasons behind this...

Do you use member initialization

9条回答
  •  粉色の甜心
    2020-11-21 05:28

    Apart from the performance reasons mentioned above, if your class stores references to objects passed as constructor parameters or your class has const variables then you don't have any choice except using initializer lists.

提交回复
热议问题