CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Posts
    56

    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


  2. #2
    Join Date
    Oct 2001
    Location
    Phoenix, AZ
    Posts
    54

    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

  3. #3
    Join Date
    Oct 2001
    Location
    Bangalore.INDIA
    Posts
    25

    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
  •  





Click Here to Expand Forum to Full Width

Featured