Interfaces in Visual Basic .NET
Visual Studio .NET 2003
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.
Versions of Visual Basic prior to Visual Basic .NET could consume interfaces but not create them directly. Visual Basic .NET introduces 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 .NET implements them.
- Interface Definition
- Describes how to define interfaces with the Interface and End Interface statements.
- Implements Keyword
- Describes how to signify that a section of code implements a specific interface.
- Interface Implementation Examples
- Provides three examples of interface implementation.
- When to Use Interfaces
- Discusses when to use interfaces instead of an inheritance hierarchy.
- Creating and Implementing an Interface
- Provides the steps involved in defining and implementing an interface, plus 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
- Describes how Visual Basic .NET supports inheritance, allowing you to define classes that serve as the basis for derived classes.