Why C# doesnt support Multiple inheritance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bremanand
    New Member
    • Jul 2006
    • 29

    Why C# doesnt support Multiple inheritance

    Hi...
    i need the solution of Why C# doesnt support Multiple inheritance????
    Let me know the solution plz..
    Thanks&Regards,
    Bremanand.S
  • axas
    New Member
    • Jul 2006
    • 32

    #2
    You have to use Intefaces for supporting multiple inheritance.
    The reason is that is a better programming technique.

    Comment

    • dotnet
      New Member
      • Jul 2006
      • 22

      #3
      Not just C#, infact complete CLR doesn't support mutiple inheritence. However you can achieve your functionality using interfaces.

      There are several reasons for multiple inheritence in not introduced in CLR.
      First and foremost, .net allows you to use mutiple languages and each of these language would behave differently on how multiple inheritence works over it. So it was difficult for designers to resolve this issue.
      Also mutiple inheritence create lot of complexity in the code.

      for more read http://blogs.msdn.com/csharpfaq/arch.../07/85562.aspx
      Last edited by pbmods; Oct 18 '07, 10:42 PM. Reason: Blocked sig.

      Comment

      • fiatnm
        New Member
        • Jul 2006
        • 4

        #4
        A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.

        Comment

        • phuff34
          New Member
          • Oct 2007
          • 1

          #5
          Originally posted by fiatnm
          A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.
          :Deleted:

          Your response was not constructive. Please refrain from being a jerk. If you would like to restate your point in a polite and concise manner you can reply to this post.

          -MODERATOR
          Last edited by RedSon; Oct 18 '07, 08:12 PM. Reason: Response deleted for trolling.

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            What language DOES support multiple inheritance?
            Java doesn't.
            None of the .net stuff does.

            I think mozart/oz does, but that language is crazy.



            Also, picking on someone for their terrible argument then making an equally terrible statement is kind of defeating. Unless that was the point and I missed it.
            Last edited by RedSon; Oct 18 '07, 08:16 PM. Reason: Removed reference to deleted post.

            Comment

            • RedSon
              Recognized Expert Expert
              • Jan 2007
              • 4980

              #7
              Originally posted by fiatnm
              A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.
              This is incorrect. A child class can have many parents if it aggregates the functionality of those parent classes.

              Consider a real life example, amphibious vehicles are able to traverse both land and sea. Therefore in a programming environment it would make sense for them to inherit from both "car" and "boat" classes.

              Comment

              • mikeyeli
                New Member
                • Oct 2007
                • 63

                #8
                Axas and dotnet are right, just imagine the mess it would be with multiple inheritance.

                in my opinion, it just makes no sense. During all the time ived been developing in c++, never have i used multiple inheritance. why? Because the maintenance of the code is a lot more difficult, understanding the code is harder, and whole lot of programming difficulties it implies, and the most important reason, i just never encountered any real need to use it, besides if you ever search up multiple inheritance in c++, theres is no real example that proves it useful.

                Then i started developing java apps and found that interfaces where alot more practical and useful, because you can multiply inherit the interface, but not the imlementation, wich was up to the client class. wich simply does make sense,
                code looks clean and understandable.

                So as a conclusion. I think creators of c#, really made a noticable upgrade to c++, added some stuff that came along with java that simply seemed useful(and other new stuff that .net implies being .net language) and voila, resulted in c#

                Comment

                • simadri
                  New Member
                  • Mar 2008
                  • 1

                  #9
                  Originally posted by fiatnm
                  A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.

                  in c++ multiple inheritance is support, then why not in c#?

                  Comment

                  • RedSon
                    Recognized Expert Expert
                    • Jan 2007
                    • 4980

                    #10
                    Here is the truth, straight from the horse's mouth...

                    Comment

                    Working...