VB.net Program to Demonstrate the ‘Friend’ Keyword

You are currently viewing VB.net Program to Demonstrate the ‘Friend’ Keyword

VB.Net program to demonstrate the ‘Friend’ keyword

'VB.net program to demonstrate the "Friend" keyword.

Class Sample
    ' The Fun() is public if we are in the same assembly.
    Friend Sub Fun()
        Console.WriteLine("Friend function Fun() called")
    End Sub
End Class

Module Module1
    Sub Main()
        Dim obj As New Sample()
        obj.Fun()
    End Sub
End Module
Friend function Fun() called
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