Uninitialized constant members in classes

前端 未结 3 513
心在旅途
心在旅途 2021-01-04 17:50

This is probably a ridiculously easy question, but I\'ve been searching around for the answer for a while yet can\'t seem to figure this out. I\'m trying to initialize a con

3条回答
  •  不知归路
    2021-01-04 18:31

    You must initialize your constant member in the initialization list of ALL constructors. You are doing it only for the one with an argument. Do it for the default one too, and everything will be fne. In this particular case, either initialize your thresh with 0, or disable the default constructor.

提交回复
热议问题