What is the member variables list after the colon in a constructor good for?

前端 未结 8 1055
予麋鹿
予麋鹿 2020-12-11 02:34

I\'m reading this C++ open source code and I came to a constructor but I don\'t get it ( basically because I don\'t know C++ :P )

I understand C and Java very well.

8条回答
  •  爱一瞬间的悲伤
    2020-12-11 03:07

    You're correct. Its a way to set the default values for the class variables. I'm not too familiar with the exact difference between putting them after : and in the function body.

提交回复
热议问题