Results 1 to 7 of 7

Thread: [2005] Inheritance Question

  1. #1

    Thread Starter
    Hyperactive Member NPassero's Avatar
    Join Date
    May 2007
    Location
    NJ
    Posts
    272

    [2005] Inheritance Question

    I am inheriting properties from Developer Express (www.devexpress.com) controls - And they're are two types of controls that have the same functionality but they are on two different levels -

    What I am talking about is a DateEdit, and a RepositoryItemDateEdit - The DateEdit.Properties has all of the features of the RepositoryItemDateEdit - but the RepositoryItemDateEdit does not have the DateEdit's features -

    Where I need help is that in a GridControl, you can only use a RepositoryItemDateEdit as an editor - and not the DateEdit control. Is there a way to have my object inherit one or the other? and just check for the type - Or do I have to do dual both of them, and make sure they match -

    I'm trying to get the best way to complete this task - any help would be great - Thanks

  2. #2
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: [2005] Inheritance Question

    Why not inherent both of them? Then you have one "super" control.

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

    Re: [2005] Inheritance Question

    .NET only supports single inheritance. When you define a class you can choose one base class and one base class only.
    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

  4. #4

    Thread Starter
    Hyperactive Member NPassero's Avatar
    Join Date
    May 2007
    Location
    NJ
    Posts
    272

    Re: [2005] Inheritance Question

    Got any suggestions so I would not have to dual both classes when making changes ?

    Would it make sense to have the two separate classes (controls) and then have them bring in functions / subroutines from another mutual class - which has the shared functionality ?

  5. #5
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: [2005] Inheritance Question

    @jmcilhinney: Yes that is true but can the user defined class not be used as a base class to further inherit more features? forgive me if this is wrong but i thought this is possible.

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

    Re: [2005] Inheritance Question

    You basically have two choices as far as I can see:

    1. Inherit both classes separately.
    2. Inherit one class and then add the extra functionality of the other yourself.
    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

  7. #7
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: [2005] Inheritance Question

    If you want C to inherit A and B in .Net, then you make B inherit A, and C inherit B.

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