Initialize in this way
class CMine
{
static int m_nCount;
public:
static int count() { return m_nCount; }
};
int CMine::m_nCount = 0;
--
initialize no-static const variable : use initialize list.
initialize reference variable: use initialize list.
const int m;
int &r;
CMine(int n): m(1), r(n) {};
No comments:
Post a Comment