class NoDefault { public: NoDefault(int i):val(i){} private: int val; }; class C { public: C() :m_nd(0){}; //or C(int i = 0):m_nd(i){} private: NoDefault m_nd; }; int _tmain(int argc, _TCHAR* argv[]) { C c; return 0; }
类NoDefault没有默认的构造函数
原文:http://my.oschina.net/hejunsen/blog/511475