Results 1 to 5 of 5

Thread: Sub-classing ???????????

  1. #1
    Guest

    Red face

    Am waiting for a data extract to complete on a solarius box, so figured l would surf the net. Ok l know what classes are, and use them extensively. But what the hell is sub classing and inheritance???

    This are going to be native to vb7 so figure l better find out exactly what they are, how to use them, and when to use them.

    Thanks in Advance.

  2. #2
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    If you have Classes figured out, then Sub-classing is pretty easy to understand. A subclass is a specialized implementation of a class. To steal a little bit from Deborah Kurata's book Doing Objects in Visual Basic 6... subclasses have an "is a" relationship to a class. If you have a class called EMPLOYEE defined, you can create a more specialized class (subclass) called PROGRAMMER and another one called CARPENTER. Each programmer "is an" employee and each carpenter "is an" employee. Each of these subclasses will have all of the properties and methods that you define for them AND they will have all of the properties and methods defined for the parent class EMPLOYEE. That's where inheritance comes in... The PROGRAMMER subclass inherits the properties and methods of the parent class EMPLOYEE.

    Here is a bit more to give you an idea of this stuff.

    An EMPLOYEE class has Properties called NAME and ADDRESS.
    The PROGRAMMER subclass will also have the properties NAME and ADDRESS (They inherit these properties from the EMPLOYEE class), but the PROGRAMMER subclass can have its own property(s) called PROGRAMMING LANGUAGES and its own methods defined.

    This is a basic description, but I hope it gives you an idea of what Subclass and inheritance is.

    Good luck.

    JC.
    JC

  3. #3
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Question Er?

    I'm pretty sure subclassing is used to trap Windows
    Messages and make your own events from them. (eg you
    can trap WM_Move and make an event out of it)

    I'm not 100% on the precise definition of inheritance, but I
    think jcouture100 is right.

    Sorry if this is wrong, but I'm pretty sure it isn't,

    Bye!

    Me

    [Edited by V(ery) Basic on 04-24-2000 at 04:22 AM]
    Courgettes.

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I didn't think you could do inheritance in VB, How do you get these working?

  5. #5
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Subclassing in windooz is pretty much used to catch windowmessages, but it's confusing since it contains class in it, which implies it has something to do with classes...
    Anyway, you can;t inheret (yet), but you can look up the Implements keyword in your MSDN, it's not truely inheritence, but until then, it's a pretty nice and usefull alternative.
    Hope this helps

    Crazy D

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