Results 1 to 10 of 10

Thread: Inheritance ..

  1. #1

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Inheritance ..

    VB.NET does not support Multiple Inheritance. The problem here is .. you can write classes and manage it with Deep Inheritance.

    So Car Class can inherit Auto and Parts can inherit Car to get to Auto.

    But how can you manage this in Windows Forms ? They are apparently nothing but classes and they are always inheriting Inherits System.Windows.Forms.Form ... so how do you implement deep inheritance here ?

  2. #2
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    What are you trying to do with Forms? I mean, you can create a custom form that inheritsa from a regular form, and then inherit from that. They are, as you have said, just classes.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Let's get it straight shall we?

    VB does not support Multiple-Base inheritance but it does support Multiple-Level Inheritance (deep).
    I don't live here any more.

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi wossname,

    Ref. your new signature. You mean that what comes out of your mouth is the same as comes out of my a.......?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Inheritance ..

    Originally posted by spoiledkid

    But how can you manage this in Windows Forms ? They are apparently nothing but classes and they are always inheriting Inherits System.Windows.Forms.Form ... so how do you implement deep inheritance here ?
    Multiple inheritance would be done with your own custom classes, as need-be. Like the example you mentioned.

    With WIndows Forms though, you can try out visual inheritance. You start off with a basic form, Form1, which inherits Sys.win.forms. Then let form2 inherit form1, and add a few controls to it.

    Then let form3 inherit form2, and add a few more elements.

    Finally, try working with it and you'll get so confused that you'll run out into the forest screaming in frustration and start bashing your head against a tree.

    Edit: D'oh! I read it wrong!

    */me runs into forest screaming, bashes head against tree in frustration*
    Last edited by mendhak; Jun 29th, 2004 at 07:17 AM.

  6. #6
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    The bottom line here is this:
    VB.NET does not support Multiple Inheritance.
    The fact that it supports inheritance at all is a long awaited gift. I've been programming with VB since 1993, and I can assure you that any support of inheritance at all is a god send. Having said that, in order to support multiple inheritance, you will probably need to switch languages for that kind of support. The nice thing about .NET is that you can mix languages. So if you need to write the bulk of your code in VB but end up needing a Class or two written in a language that supports multiple inheritance then I suggest writting those classes/forms in C#. C# is not a difficult language to learn and should solve your problem.

  7. #7

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by CyberHawke
    The bottom line here is this:


    The fact that it supports inheritance at all is a long awaited gift. I've been programming with VB since 1993, and I can assure you that any support of inheritance at all is a god send. Having said that, in order to support multiple inheritance, you will probably need to switch languages for that kind of support. The nice thing about .NET is that you can mix languages. So if you need to write the bulk of your code in VB but end up needing a Class or two written in a language that supports multiple inheritance then I suggest writting those classes/forms in C#. C# is not a difficult language to learn and should solve your problem.
    C# does not support multiple inheritance either ...

  8. #8
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    You might want to think about interfaces instead, You can use a class to implement multiple interfaces.

    This may or may not be plausible for your project though.
    I don't live here any more.

  9. #9
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    I stand corrected, I knew that I had done some work with mutiple interfaces and I guess I confused it. The work I did worked with several interfaces that I had created and then implemented those interfaces in a single class instance. Sorry if I confused anyone.

  10. #10

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by wossname

    This may or may not be plausible for your project though.
    well, there you go .. tx anyway.

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