program to demonstrate concept of interface.
-----------------------------------------code---------------------------------------------------------
Imports System.Console
Module Module1
Sub Main()
Dim obj1 As New one
Dim obj2 As New two
obj1.disp()
obj1.multiply()
obj2.disp()
obj2.multiply()
ReadKey()
End Sub
End Module
Public Interface test
Sub disp()
Function multiply() As Double
End Interface
Public Class one
Implements test
Public i As Double = 12
Public j As Double = 12.17
Public Sub disp() Implements test.disp
WriteLine("sum=" & i + j)
End Sub
Public Function multiply() As Double Implements test.multiply
WriteLine("muliplication=" & i * j)
End Function
End Class
Public Class two
Implements test
Public a As Double = 20
Public b As Double = 32.17
Public Sub disp() Implements test.disp
WriteLine("Welcome to interface")
End Sub
Public Function multiply() As Double Implements test.multiply
WriteLine("multiplication=" & a * b)
End Function
End Class-----------------------------------------output----------------------------------------------------
codestrew |