locked
C# Multiple Inheritance

    Question

  • 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.
    Thursday, January 21, 2010 11:43 AM

Answers

  • 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)
    Thursday, January 21, 2010 2:14 PM
  • 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).
    Thursday, January 21, 2010 12:09 PM

All replies

  • 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).
    Thursday, January 21, 2010 12:09 PM
  • 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)
    Thursday, January 21, 2010 2:14 PM
  • Thanks alot..
    Please mark the post as Answer/ Helpful, if it helps you.
    Friday, January 22, 2010 9:31 AM