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

前端 未结 8 1037
予麋鹿
予麋鹿 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:16

    The code between the argument list and the {}s specifies the initialization of (some of) the class members.

    Initialization as opposed to assignment---they are different things---so these are all calls to constructors.

提交回复
热议问题