Implements Keyword


Implements Keyword

Syntax

     Implements interfaceName.interfaceMember[, ...] 


interfaceName (required)

The name of the interface being implemented by a class or structure. This interface must appear in the related Implements statement used at the start of the class or structure.


interfaceMember (required)

The name of the interface member being implemented by a local member of the current class or structure.

Description

The Implements keyword indicates that a specific class or structure member provides the implementation for a member defined in an interface. This keyword appears as part of the implementation member definition.

Usage at a Glance

  • The Implements keyword can only be used in a class or structure in which the Implements statement has also been used to associate the matching interface to the class or structure.

  • The Implements keyword must be on the same logical line as the property, function, procedure, or event definition that implements the interface member.

  • The implementing member must have the same argument and return type signature, and be of the same member type, as the interface member.

  • Classes and structures that implement interfaces must implement all members declared in the interface.

Example

See the example in the Implements Statement entry.

Version Differences

  • The Implements keyword is new to VB under .NET. Its addition means that the implementation of a class or structure member does not have to use the name defined by the interface. This differs from the VB 6 practice, which required that class members that implemented an interface definition have the form interfaceName_membername.

  • VB 6 does not allow derived classes to implement events defined in interfaces. The .NET version of Visual Basic removes this restriction.

See Also

Implements Statement, Interface...End Interface Statement




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net