|
-
October 24th, 2001, 05:31 PM
#1
Interface Inheritance, Implements
Hi Gurus,
What is the benefit of using Interface Inheritance or Implements and When to use it?
Thanks a lot in advance.
MsJane
-
October 25th, 2001, 04:53 PM
#2
Re: Interface Inheritance, Implements
Pros:
Private implementation forcing the caller to use only the interface provided.
Multiple interface support without name collisions.
Polymorphism.
And, arguably, code reuse.
Cons:
wasted code since VB doesn't distinguish between a class and an interface.
Quite a few more caveats better explained by Matt Curland in his book Advanced VB 6(http://www.powervb.com).
When to use:
A matter of taste and probably too many cases to be explained here. Use your imagination. Think of a problem that could be solved by multiple implementations of the same interface.(e.g. Plugins) You could still write effective VB code without ever having to use Implements.
Software is like sex, it's better when it's free - Linus Torvalds
Software is like sex, it's better when I get paid for it. - me
-
October 30th, 2001, 11:54 PM
#3
Re: Interface Inheritance, Implements
Hi,
You can use impelements after u defined an
interface in Vb.This class will have only method
defenitions not the actual methods.
U may use this if u want some classes to
necessarly use an interface.
So after impelementing an interfece earlier defined in ur class by using IMPLEMENTS keyword it wont allow compilation without writing methods in the impelemented interface.
Regards
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
|