Non-static data members
Non-static data members
Non-static data members are declared in a member specification of a class.
class S { int n; // non-static data member int& r; // non-static data member of reference type int a[10] = {1, 2}; // non-static data member with initializer (C++11) std::string s, *ps; // two non-static data members struct NestedS { std::string s; } d5, *d6; // two non-static data members of nested type char bit : 2; // two-bit bitfield };
Any simple declarations are allowed, except.