Implements Keyword

   
Implements Keyword

Syntax

 Implements   interfacename   .   interfacemember   [, ...] 
interfacename (required; String literal)

The name of the interface being implemented by a class

interfacemember (required; String literal)

The name of the interface property, function, procedure, or event that is being implemented by a class

Description

Indicates that a class member provides the implementation of a member defined in an interface

Rules at a Glance

  • The Implements keyword can only be used in a class module in which the Implements statement has been used to define an abstract base class that the class is to implement.

  • The Implements keyword follows the property, function, procedure, or event definition, and must be on the same line.

  • The class member implementing the interface member must be of the same type (property, function, procedure, or event) as the interface member, and its argument list and, in the case of functions and properties, return type must also be identical to that of the interface member.

  • Class members must implement all of the members declared in the interface.

Example

See the example in the Implements Statement entry.

VB.NET/VB 6 Differences

  • The Implements keyword is new to VB.NET. Its addition means that the implementation of a property, function, procedure, or event does not have to use the name defined by the interface. This modifies the VB 6 practice, which requires that class members that implement an interface definition have the form interfacename _ membername .

  • VB 6 does not allow derived classes to implement events defined in interfaces. VB.NET removes this restriction.

See Also

Implements Statement, Interface Statement

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

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