< Visual Basic .NET

Interfaces

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

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.