There are four special functions fundamentally implicitly declared.
Question:
If any one of them is defined by user, [eg: Destructor ] rest of the three functions will not get declared. Is that the correct? or it is applicable only to default constructor, and copy Constructor?
If you declare your own constructor, of any type (including copy constructor), then the default constructor is no longer implicitly declared. The rest are (unless you have declared one of them yourself).
However, if you find yourself declaring any one of 2, 3 or 4, then you most likely should declare the other two, even if the compiler implicitly declares them. This is known as the rule of three.
Edit in C++11 there are also implicitly declared move copy constructor and a move assignment operator, so the rule of three becomes the rule of five.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With