Visual Basic .NET/Interfaces

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Interfaces[edit | edit source]

An interface is the public methods of a class. They are declared with the Implements keyword.

To create an interface:

Public Interface Interface1
   Function Function1() As String
End Interface

To use it from a class:

Public Class MyClassFromInterface
    implements Interface1()
    ' by pressing enter the IDE creates automatically the implemented interface elements:
    Public Function Function1() As String Implements Interface1.Function1
        ' ...
    End Function
End Class


Reference[edit | edit source]