Q
Problem solve Get help with specific problems with your technologies, process and projects.

Can a child class have multiple parents?

Can a child class have multiple parents? What is a good example of this? Can multiple child classes have the same parent? Can you provide an example of this as well? Thank you.
In .NET languages, you cannot have multiple inheritance at all, so it's a single parent to child relationship. However, in native C++, you can have multiple inheritance -- hence, a many to one relationship.

While it is possible, in most good development shops, multiple inheritance is considered very poor programming practices. In fact, for the developers in my shop, we consider it a reason to fail a code review. The problem is that it makes the code much harder to read (as in "where the heck did this method come from?") and adds a considerable amount of complexity to the overall code. You're goal when coding is to make a correct, maintainable solution that a new hire fresh out of college can read.

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close