Can someone please explain this MyClass(int a) : var(a) { } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone please explain this MyClass(int a) : var(a) { }

C++

24th Jun 2019, 6:37 PM
Lehlohonolo Motsei
Lehlohonolo Motsei - avatar
1 Answer
+ 1
MyClass(into a){var {a};} initializes var twice, in list and block. So we can say that using list in this case is more efficient
27th Jun 2019, 12:49 AM
Mandla Thabethe
Mandla Thabethe - avatar