VB.Net Program to Implement an Interface in the Structure

You are currently viewing VB.Net Program to Implement an Interface in the Structure

VB.Net program to implement an interface in the structure

'VB.net program to implement an interface in the structure.

Module Module1
    Interface ISample
        Sub Fun()
    End Interface

    Structure Sample
        Implements ISample
        Sub Fun() Implements ISample.Fun
            ' Method Implementation
            Console.WriteLine("Fun() called inside the structure")
        End Sub
    End Structure

    Sub Main()
        Dim S As New Sample()
        S.Fun()
    End Sub
End Module

Output

Fun() called inside the structure
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply