Introduction:

In this articals we will see how to implement of multiple interface in vb.net an interface can obtain one or more methods,properties,indexers and events.
But none of them are implemented in the interface itself.it is the responsibility of the class that implements the interface to define the code for implementation of these membersvb.net does not support directly multiple inheritance but using interface we can use multiple inheritance.
interface keywords to create an interface& implement keywords is use to implememt the interface.
this code implementing two interfaces.The class Computation implement two interfaces Addition and Multiplication.it declare two data members and define the code for the methods Add and multiplication.

code implementation of Multiple interfaces:

Module Module1

Interface Addition

Function Add() As Integer

End Interface

Interface Multiplication

Function Mul() As Integer

End Interface

Class Computation

Inherits Addition

Inherits Multiplication

Private x As Integer, y As Integer

Public Sub New(ByVal x As Integer, ByVal y As Integer)

Me.x = x

Me.y = y

End Sub

Public Function Add() As Integer

Return (x + y)

End Function

Public Function Mul() As Integer

Return (x * y)

End Function

End Class

Class interfaceTest1

Sub Main()

Dim com As New Computation(10, 20)

Dim add As Addition = DirectCast(com, Addition)

Console.WriteLine("sum =" & add.Add())

Dim mul As Multiplication = DirectCast(com, Multiplication)

Console.WriteLine("product =+" & mul.Mul())

End Sub

End Class

End Module

Ouput of program will be:
interface.gif