A static const int member initialized in-class - , .
const int , , . , -, mem. , , , :
class Foo {
const int x = 5;
public:
inline int get() { return x; }
Foo() = default;
Foo(int x) : x(x) {}
};
Foo::x 5, , - , Foo::Foo(int). , , :
class Foo {
public:
const int x = 5;
inline int get() { return x; }
};
:
Foo f {42};
// f.x is 42
Foo, , , , Foo::x 5, , Foo::x - . , .