+ 1
C++ - colon after constructor
What does it mean and do when you have a colon after the constructor? MyClass() : something { }
1 Respuesta
+ 4
That signifies an initialization list.
Which can be used in inheritance (call base class) or for initializing member vars before the constructor/body is executed.
Here’s a simple ref: https://www.learncpp.com/cpp-tutorial/constructor-member-initializer-lists/