Interfaces in Visual Basic
Interfaces define the properties, methods, and events that classes can implement. Interfaces allow you to define features as small groups of closely related properties, methods, and events; this reduces compatibility problems because you can develop enhanced implementations for your interfaces without jeopardizing existing code. You can add new features at any time by developing additional interfaces and implementations.
In previous versions of Visual Basic, you could consume interfaces but not create them directly. In this version, you can use the Interface statement, which allows you to define true interfaces as distinct entities from classes, and to implement them with an improved version of the Implements keyword.
In This Section
Interfaces Overview
Provides an overview of what interfaces are and how Visual Basic implements them.Interface Definition
Describes how to define interfaces with the Interface and End Interface statements.Implements Keyword and Implements Statement
Describes how to signify that a section of code implements a specific interface.Interface Implementation Examples in Visual Basic
Provides three examples of interface implementation.When to Use Interfaces
Discusses when to use interfaces instead of an inheritance hierarchy.How to: Create and Implement Interfaces
Lists the steps involved in defining and implementing an interface, plus provides examples.Walkthrough: Creating and Implementing Interfaces
Provides a detailed procedure that takes you through the process of defining and implementing your own interface.
Related Sections
- Inheritance in Visual Basic
Describes how Visual Basic supports inheritance, allowing you to define classes that serve as the basis for derived classes.