c++ - Is in-class initialization "real" when it appears? -


c++11 introduced this:

struct myclass {   int foo = 0; //* }; 

until i've been using without thinking it, i'm wondering:

is initialization doing/executing actual initialization @ particular line (//* in code), or mere convenience notation does/executes later, when object constructed?

not sure mean "later" , "at particular line", above equivalent following:

struct myclass {     myclass() : foo(0) { } }; 

so if understand question correctly, answer is: "yes, when object constructed".


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -