Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Multiple Inheritance

C# inheritance

  • Please log in to reply
3 replies to this topic

#1 Tonchi


    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 08 September 2012 - 07:21 AM

I am starting to create some custome controls for WPF (C#) and I want to know is it possible to inherite 2 classes in my class like this:

public class MyCustomControl:Button:WebBroser




  • 0

Microsoft Student Partner, Microsoft Certified Professional

#2 BlackRabbit


    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 08 September 2012 - 08:57 AM

Take a look at this, so i save myself the explaining, lol

Click here for the multiple inheritance help

as you see Tonch, this subject is different to c++, in c# you need some tricky ways :D
  • 0

#3 VNFox


    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 648 posts
  • Programming Language:C#, PHP
  • Learning:Assembly

Posted 08 September 2012 - 10:49 AM

U can't have multiple inheritance ... you can have multiple interfaces but not multiple inheritance. Besure to remember that they may ask you in the interview question :)
  • 0

I don't just develop software. I find solutions to your business needs.

#4 AceInfinity


    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 313 posts
  • Programming Language:C, C++, C#, Perl, Visual Basic .NET, Assembly, VBScript, Others

Posted 09 September 2012 - 04:01 PM

How would you make a class inherit both a button and a webbrowser at the same time anyways? What would 'this' represent for that class?
  • 0

Microsoft MVP (2012) - .NET Programming | ®Crestron DMC-T Certified Programmer
Posted Image

Also tagged with one or more of these keywords: C#, inheritance

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download