How to write nested classes in

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 198
Nested classes are those classes that are contained in another class declarations. The below program in will demonstrate this

Namespace ConsoleApplication1
Class Program
Private Shared Sub Main(args As String())
Dim objOuterClass As New OuterClass()
Dim innerClass = New OuterClass.InnerClass()
End Sub
End Class
Class OuterClass
Public Sub SayHelloFromOuterClass()
Console.WriteLine("Hello from Outer Class")
End Sub
Public Class InnerClass
Public Sub SayHelloFromInnerClass()
Console.WriteLine("Hello from Inner Class")
End Sub
End Class
End Class
End Namespace

Comments or Responses

Login to post response