default arguments in constructor

后端 未结 5 1981
失恋的感觉
失恋的感觉 2021-01-15 16:52

Can I use default arguments in a constructor like this maybe

Soldier(int entyID, int hlth = 100, int exp = 10, string nme) : entityID(entyID = globalID++), hea

5条回答
  •  孤街浪徒
    2021-01-15 17:24

    Arguments with default values must be the last arguments in the function declaration. In other words, there can not be any arguments without default values following one with a default value.

提交回复
热议问题