Why does compilation fails in this case ?
Is this what happened ? : constructor of Employee calls default constructor of Person and that’s all.
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.
You need to call a constructor in Person when constructing an Employee. By default, the compiler will call the default constructor (with no arguments), but in this case, it doesn’t exist in Person (the compiler creates a default constructor only if no other constructor exists).
You must call to a concrete constructor of Person in the first line of Employee constructor, or defining a default constructor in Person.