0
C++
lass MyClass { public: int var; MyClass() {} MyClass(int a) : var(a) { } }; in this class when we overload is the writting of int var ; important or not if we dont write what will happen .
2 Answers
0
That style of writing variable after colon in constructors is called initializer list. If don't write it then nothing will happen. You will just need to add the variable assignment code in the constructors body.