Locked C# Multiple Inheritance

  • Thursday, January 21, 2010 11:43 AM
     
     
    hi all.
    What are those points due to which C# doesn't support multiple inheritance?
    Please mark the post as Answer/ Helpful, if it helps you.

All Replies

  • Thursday, January 21, 2010 12:09 PM
     
     Answered
    Quote from the linked article below:  "The biggest problem with multiple-inheritance is that it allows for ambiguity when the compiler needs to find the correct implementation of a virtual method."


    http://msdn.microsoft.com/en-us/library/ms973861.aspx (halfway down the page).
    • Marked As Answer by Hassan Mehmood Friday, January 22, 2010 9:31 AM
    •  
  • Thursday, January 21, 2010 2:14 PM
    Moderator
     
     Answered
    C# implements single inheritance but allows for multiple interfaces at the same time. This achieves the same end goal as would multiple inheritance without the compiler/language issues with cross multiple inheritance can have such as found in the Diamond problem of multiple inheritance. HTH
    William Wegerson (www.OmegaCoder.Com)
    • Marked As Answer by Hassan Mehmood Friday, January 22, 2010 9:31 AM
    •  
  • Friday, January 22, 2010 9:31 AM
     
     
    Thanks alot..
    Please mark the post as Answer/ Helpful, if it helps you.