can you do inheritance with more than five classes?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Mar 6, 2014, 1:21 AM EST
C# doesn't support multiple inheritance where a class can have two or more parent classes.
Mongezi Sithole36 reputationPosted Mar 6, 2014, 9:57 PM EST
Lindoh Mthiya11 reputationPosted Mar 6, 2014, 10:42 PM EST
yes as long as they after not sealed
Mhlengi Ntshangase9 reputationPosted Mar 6, 2014, 10:50 PM EST
VulpesRank #55 · 29.2K reputationPosted Mar 7, 2014, 1:24 AM EST
Yes, there are languages which support multiple inheritance despite the ambiguities which this entails.
They include well known languages such as C++, Eiffel, Perl and Python.
Lindokuhle Dlamini7 reputationPosted Mar 7, 2014, 1:43 AM EST
Mongezi Sithole36 reputationPosted Mar 7, 2014, 3:30 AM EST
Mongezi Sithole36 reputationPosted Mar 7, 2014, 3:30 AM EST
VulpesRank #55 · 29.2K reputationPosted Mar 7, 2014, 11:27 AM EST
The most obvious one is a Person class which inherits from both a Mother and a Father class.
Check out this link which has some class diagrams for multiple inheritance in C++ including one for the 'diamond' problem where a class inherits from two classes which each inherit from a single base class:
http://www.learncpp.com/cpp-tutorial/117-multiple-inheritance/