Name

Implements Keyword

Syntax

Implementsinterfacename.interfacemember
interfacename

Use: Required

Type: String literal

The name of the interface being implemented by a class

interfacemember

Use: Required

Type: 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. This 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 ...

Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.