C++ const Initializer Lists

preview_player
Показать описание
Jamie King showing how to use a C++ constructor initializer list to initialize constant data.
Рекомендации по теме
Комментарии
Автор

you can initialize the class variables before getting into the body of the class constructor with the help of the colon symbol.
The variable must be initialized with the colon symbol if it is declared as a constant, so it must have a value before the program enters the body of the constructor.

treasure
Автор

the 'initialisor'
cat(int lives)
is that the same as a constructor, and is there any difference in doing it like this instead:
cat::cat(int lives)

?

computerfis