Friend
Friend
Friend. This modifier makes a member (like a Class, Sub or Function) unavailable outside the present assembly. An assembly is physical file that contains compiled code.
Here:
We specify that Display() is a Friend Sub. So it is Public inside the assembly, but not available outside.
VB.NET that uses Friend
Class Item
Friend Sub Display()
Console.WriteLine("Friend Class used")
End Sub
End Class
Module Module1
Sub Main()
' The Display Sub is public if we are in the same assembly.
Dim local As Item = New Item()
local.Display()
End Sub
End Module
Output
Friend Class used
Friend. This modifier makes a member (like a Class, Sub or Function) unavailable outside the present assembly. An assembly is physical file that contains compiled code.
Here:
We specify that Display() is a Friend Sub. So it is Public inside the assembly, but not available outside.
VB.NET that uses Friend
Class Item
Friend Sub Display()
Console.WriteLine("Friend Class used")
End Sub
End Class
Module Module1
Sub Main()
' The Display Sub is public if we are in the same assembly.
Dim local As Item = New Item()
local.Display()
End Sub
End Module
Output
Friend Class used
Comments
Post a Comment