why it still work when i initialize variables in the class declaration?

I know that there are only two kind of types can be initialized in the class declaration, which are enum type and static const interger type. But when I initialize "const int", even the "int", the compilation is still ok. Why?

and why static int type initialization in-class is wrong?

> But when I initialize "const int", even the "int", the compilation is still ok. Why?

http://www.stroustrup.com/C++11FAQ.html#member-init


> and why static int type initialization in-class is wrong?

An in-class member initializer for a non-static member is (if required) used by the constructor to perform run-time initialization of the member. (Each object has its own non-static member).

This is not the case for static members.
Perhaps show the code in question?
Topic archived. No new replies allowed.