Whats the other option we can use for multiple inheritance other than implementing interface
Whats the other option we can use for multiple inheritance other than implementing interface
Share
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.
A direct answer is to use inner classes. That gives you two (or more) objects that are intimately linked but cover independent base classes.
In general, prefer composition over inheritance. It’s a common mistake to use inheritance everywhere. However, that leaves inflexible solutions that are difficult to follow.