One Class implements two Interfaces which have the same name method : Interface « Class « VB.Net






One Class implements two Interfaces which have the same name method

One Class implements two Interfaces which have the same name method
Imports System
Imports System.Data
Imports System.Collections

public class MainClass
   Shared Sub Main()
        Dim c As New Class1()
        Dim i2 As MySecondInterface
        c.CommonFunction()
        i2 = c
        i2.CommonFunction()
   End Sub
End Class


Interface MyFirstInterface
    Sub UniqueFunction()
    Sub CommonFunction()
End Interface

Interface MySecondInterface
    Sub SecondUniqueFunction()
    Sub CommonFunction()
End Interface

Public Class Class1
    Implements MyFirstInterface
    Implements MySecondInterface

    Sub UniqueFunction() Implements MyFirstInterface.UniqueFunction

    End Sub

    Sub SecondUniqueFunction() Implements MySecondInterface.SecondUniqueFunction

    End Sub

    Sub CommonFunction() Implements MyFirstInterface.CommonFunction
        Console.WriteLine("Common Function on first interface")
    End Sub

    Sub CommonFunctionSecondInterface() Implements MySecondInterface.CommonFunction
        Console.WriteLine("Common function on second interface")
    End Sub

End Class

           
       








Related examples in the same category

1.Interface inherits interfaceInterface inherits interface
2.Class implements two interfaces
3.Implements an InterfaceImplements an Interface
4.Implement an InterfaceImplement an Interface
5.Define and use Interface AgeDefine and use Interface Age
6.Interface Inherits another InterfaceInterface Inherits another Interface
7.Define and use InterfaceDefine and use Interface
8.Implements Two InterfacesImplements Two Interfaces
9.Generic Class and InterfaceGeneric Class and Interface