It is useful to make a distinction between a class’s interface and its implementation. Conceptually, the interface of a class is the set of members that are visible to users of the class—i.e., the class’s public members. The public members are thought of as comprising the class’s interface because they are the only way that code outside of the class can interact (i.e., interface) with objects of that class. In contrast, the implementation is comprised of the class’s code plus the set of members that are not public.
It is possible to take this interface concept further and separate
interface definition from class definition altogether. This has
benefits that will be shown shortly. To define an interface, use the
Public Interface ISomeInterface Sub SomeSub( ) Function SomeFunction( ) As Integer Property SomeProperty( ) As String Event SomeEvent( _ ByVal sender As Object, _ ByVal e As SomeEventArgs _ ) End Interface
An interface declaration defines methods, properties, and events that
will ultimately be implemented by some class or structure definition.
Because interfaces never include any implementation, the declarations
are headers only—never any implementation code;
Property statements; or property get or set
blocks. There are no access modifiers (
Private, etc.) because all members of an interface
are public by definition. By convention, interface names start with
the letter “I”.
To provide an implementation ...