Home
Code-Blog
Projects
Twitter
Blog
Links / Books
About
|
Websites |
Disabling constructors that you are not usingIf you are not implementing the default constructor, copy constructor or the assignment operator, it is a good idea to declare them but do not implement then. Doing this, you prevent that they are called automatically leaving uninitialized variables. class X { X(); // not used X(const X &); // not used Object * m_p; public: X(Object * p) : m_p(p) {} };
|