Results 1 to 15 of 15

Thread: Why Only 1 Parent in Inheritance?

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Why Only 1 Parent in Inheritance?

    Yea that diamond is an issue. To be frank, now that inheritance can only be one line, I sort of wonder. What kind of problem need inheritance at all?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Why Only 1 Parent in Inheritance?

    Quote Originally Posted by teguh123 View Post
    Yea that diamond is an issue. To be frank, now that inheritance can only be one line, I sort of wonder. What kind of problem need inheritance at all?
    You've just got to look at the .NET Framework for your answer. The Component class provides functionality that allows a class to be designed. The Control class extends that by providing UI functionality. The ButtonBase class adds functionality for a control that is intended to be "pressed" like a button. The Button, CheckBox and RadioButton classes all add specific functionality appropriate to their specific use.

    Imagine if the Button, CheckBox and RadioButton classes were all built from scratch with no inheritance. There's a whole lot of duplicated code for a start. Also, if you want to change how a button works then you have to do it in all three places.

    That's just three classes too. Think about all the other components and controls in the Framework, as well as by third parties, that also inherit the same functionality from the same base classes.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width