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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -