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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -