The compiler defined constructor is empty and does not initialize the member variables. Then why does the compiler create one?
Also what is the difference if any between a compiler defined constructor and an user defined empty constructor?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The presence or absence of a constructor affects how users of the class can instantiate the object. If the compiler didn’t create a default constructor, then you wouldn’t be able to use a class or struct unless you created your own constructor.