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
Post a Comment