Member Initializers slide 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Member Initializers slide 2

I believe the code on this page has a formatting error. look at lines 5 and 6. the curly braces {} don't line up in a logical way. 1 class MyClass { 2 public: 3 MyClass(int a, int b) 4 : regVar(a), constVar(b) 5 { 6 } 7 private: 8 int regVar; 9 const int constVar; 10 };

27th Dec 2016, 3:01 PM
Zachary Blasczyk
Zachary Blasczyk - avatar
1 Answer
0
I'd put a carriage return between them to make it more easier to recognise at a glance, then probably a comment as well. { //expressions. }
3rd Jan 2017, 12:40 AM
Allan
Allan - avatar