When no constructor is provided explicitly, the C++ compiler uses a default constructor, which is an implicit constructor that takes no arguments and does nothing. The default constructor is necessary because when an object is created, C++ always needs to call a constructor, even a degenerate one like the default constructor.
At creation, the default constructor will make the object’s member variables of unknown values, because (unlike, say, Java) C++ does not allow you to inline-initialize member variables.
[Note how much detail I give in the answer.]
You provided a lot of detail, indeed …but it would be nice if you at least mention also copy constructor
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.