|
-
Jan 5th, 2002, 12:18 PM
#4
New Member
Ive been having the same problem with the Implements statement.
I understand that there are two distinctive types of inheritence;
Interface Inheritence
Class Inheritence
I have been trying to implement classes in VB6 but I was told that you can only achieve a form of inheritence through Interface implementation.
To get round this I defined an Interface for a certain type of class.
Then made another class that implements this interface and added all of the generic code to this class, this is now the class that I intended to be the base class in the first place.
Any derived classes must implement the interface but also contain an aggregate of the class that contains the code which can be delegated to or overidden.
This seems a poor way to achieve polymorphism to me as it requires more classes than you really should have causing confusion and extra overhead.
I have just bought Dan Applemans book on COM/ActiveX which is brilliant by the way, but he demonstrates the use of class implementation in VB6 exactly like I was trying to do in the first place.
I quote
"You don't need to use an empty abstract class as the source for your interface definition, however. Having code in the source class does no harm whatsoever."
I dont believe considering Dan Applemans technical brilliance that he has got this wrong and he must have used this technique many times if hes using it as an example in his book.
But why then will the Declarations combo box not expose the properties of base classes when I try it?
Someone please explain this phenomenon if you can.
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
|