Example : Interface Examples in VB .Net program to demonstrate the Interface.
Module Module1
Interface Program1
Sub Output()
End Interface
Class Example
Implements Program1
Sub Output() Implements Program1.Output
' Method Implementation
Console.WriteLine("Interface Executed")
End Sub
End Class
Sub Main()
Dim Obj As New Example()
Obj.Output()
End Sub
End Module
Output:
Interface Executed
Example : Interface Examples in VB .Net program to demonstrate Multiple Inheritance using an Interface.
Module Module1
Interface A
Sub Display1()
End Interface
Interface B
Sub Display2()
End Interface
Interface C
Sub Display3()
End Interface
Class Example
Implements A, B, C
Sub Display1() Implements A.Display1
Console.WriteLine("Display1() Function Executed")
End Sub
Sub Display2() Implements B.Display2
Console.WriteLine("Display2() Function Executed")
End Sub
Sub Display3() Implements C.Display3
Console.WriteLine("Display3() Function Executed")
End Sub
End Class
Sub Main()
Dim Obj As New Example()
Obj.Display1()
Obj.Display2()
Obj.Display3()
End Sub
End Module
Output:
Display1() Function Executed
Display2() Function Executed
Display3() Function Executed
0 Comments