Multiple inheritance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • majid

    #1

    Multiple inheritance

    How can i write classes with multiple inheritance
  • Pete

    #2
    Re: Multiple inheritance

    Hi,

    majid wrote:[color=blue]
    > How can i write classes with multiple inheritance[/color]

    Simple answer: You can't.

    Less simple answer: You can't unless you use interfaces.

    There's lots of info on the web. Try google.

    -- Pete


    Comment

    • Benny Mathew

      #3
      Re: Multiple inheritance

      no you cant write classes with multiple inheritance, but you can achieve
      the same thing using interfaces, here's how.

      http://www.c-sharpcorner.com/Languag...eritanceCB.asp

      Cheers
      Benny

      majid wrote:[color=blue]
      > How can i write classes with multiple inheritance[/color]

      Comment

      • Ignacio Machin

        #4
        Re: Multiple inheritance

        Hi,

        Changing to C++ :)

        C# ( as well as java ) has single inheritance. why? It's simpler to
        implement the compiler and a lot of people thinks that multime inheritance
        is not needed. if you look into google you will find the arguments both
        tendences give.

        In C# you can have a class implementing multiples interfaces, this give you
        some of the features expected from multiple inheritance. you can also use
        one or more design patterns ( facade, adapter, etc ) to help you .


        Hope this help,

        --
        Ignacio Machin,
        ignacio.machin AT dot.state.fl.us
        Florida Department Of Transportation

        "majid" <majid_nzr@hotm ail.com> wrote in message
        news:5ca601c37d 02$6f068250$a60 1280a@phx.gbl.. .[color=blue]
        > How can i write classes with multiple inheritance[/color]


        Comment

        Working...