Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. multiple inheritance workaround?

multiple inheritance workaround?

Scheduled Pinned Locked Moved C#
csharpquestionwpfoop
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    donovan solms
    wrote on last edited by
    #1

    hi, i have to inherit from multiple classes. a base class i wrote, and a wpf class, like Image or so, because i'm writing some custom controls. i know c# doesn't have multiple inheritance. how can i achieve multiple inheritance functionality? thanks, donovan

    rather have something you don't need, than need something you don't have

    M V K Mircea PuiuM 4 Replies Last reply
    0
    • D donovan solms

      hi, i have to inherit from multiple classes. a base class i wrote, and a wpf class, like Image or so, because i'm writing some custom controls. i know c# doesn't have multiple inheritance. how can i achieve multiple inheritance functionality? thanks, donovan

      rather have something you don't need, than need something you don't have

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      Check out this article: http://www.c-sharpcorner.com/UploadFile/cbreakspear/MultipleInheritance11082005004843AM/MultipleInheritance.aspx[^]

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      D 1 Reply Last reply
      0
      • D donovan solms

        hi, i have to inherit from multiple classes. a base class i wrote, and a wpf class, like Image or so, because i'm writing some custom controls. i know c# doesn't have multiple inheritance. how can i achieve multiple inheritance functionality? thanks, donovan

        rather have something you don't need, than need something you don't have

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        Use Interfaces http://www.google.com/search?hl=en&q=c%23+multiple+inhertitence[^]

        1 Reply Last reply
        0
        • V Vasudevan Deepak Kumar

          Check out this article: http://www.c-sharpcorner.com/UploadFile/cbreakspear/MultipleInheritance11082005004843AM/MultipleInheritance.aspx[^]

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          D Offline
          D Offline
          donovan solms
          wrote on last edited by
          #4

          thanks,but how can i use the code that adds my custom event handlers in my class when i convert it to an interface?

          rather have something you don't need, than need something you don't have

          1 Reply Last reply
          0
          • D donovan solms

            hi, i have to inherit from multiple classes. a base class i wrote, and a wpf class, like Image or so, because i'm writing some custom controls. i know c# doesn't have multiple inheritance. how can i achieve multiple inheritance functionality? thanks, donovan

            rather have something you don't need, than need something you don't have

            K Offline
            K Offline
            Kevin McFarlane
            wrote on last edited by
            #5

            The official way of simulating multiple inheritance is to combine single inheritance with composition.

            Kevin

            1 Reply Last reply
            0
            • D donovan solms

              hi, i have to inherit from multiple classes. a base class i wrote, and a wpf class, like Image or so, because i'm writing some custom controls. i know c# doesn't have multiple inheritance. how can i achieve multiple inheritance functionality? thanks, donovan

              rather have something you don't need, than need something you don't have

              Mircea PuiuM Offline
              Mircea PuiuM Offline
              Mircea Puiu
              wrote on last edited by
              #6

              In C#, multiple inheritance is not an option, you may only inherit from one base class. If you are not satisfied with the "interface" approach, then you might consider extending one class and creating a member of the new class of the type implemented by your second class. That way, you'll be able to benefit from the methods of the second class.

              SkyWalker

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups