Answer a Ques !!!

1.Why C# does not support multiple inheritance ?

6 comments:

  1. Multiple inheritance may allow you to write compact code but it is not come of free

    it make the program difficult to understand or debug simplicity and making it easy to write robust code is one of c# design goals in other hand multiple inheritance have common problems like

    diamond problem for example



    class MyBase

    {
    public abstract void Test();
    }
    class FirstChild : MyBase

    {
    public override void Test()
    {
    Debug.WriteLine("First Child");
    }
    }
    class SeconedChild : MyBase

    {
    public override void Test()
    {
    Debug.WriteLine("SeconedChild");
    }
    }
    //Now Suppos that c# support multiple inheritance

    class AnotherChild : FirstChild, SeconedChild
    {
    }
    //now some where in your program

    //you write some thing like

    AnotherChild child=new AnotherChild();
    child.Test();

    ReplyDelete
  2. BECAUSE VB DON'T HAD MULTIPLE INHERITANCE. C# CREATED USING VB

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hey Nice Post, Keep Updating more question and answers
    http://allittechnologies.blogspot.com/

    ReplyDelete