|
-
Apr 23rd, 2000, 07:42 AM
#1
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.
-
Apr 23rd, 2000, 10:03 AM
#2
Addicted Member
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.
-
Apr 23rd, 2000, 10:20 PM
#3
Fanatic Member
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]
-
Apr 24th, 2000, 12:03 AM
#4
Frenzied Member
I didn't think you could do inheritance in VB, How do you get these working?
-
Apr 24th, 2000, 02:13 PM
#5
Hyperactive Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|