Pages

Search This Blog

Simple Interface Example


Module IntefaceExample
 
    Sub Main()
        Dim obj As New Class2
        obj.add()
        obj.pro()
        Console.ReadLine()
    End Sub
 
End Module
 
Interface in1
    Sub add()
End Interface
 
Interface in2
    Sub pro()
End Interface
 
Interface in3
    Inherits in1, in2
End Interface
 
 
Public Class Class2 : Implements in3
 
    Public Sub add() Implements in1.add
        Console.WriteLine("Add Function...")
    End Sub
 
    Public Sub pro() Implements in2.pro
        Console.WriteLine("Product Function...")
    End Sub
End Class

2 comments: