Inner classes

The classes can be nested

Inner classes
The classes can be nested

Class outerclass
Public Sub outermethod()
Console.WriteLine("from outer method...")
End Sub
Class innerclass
Public Sub innermethod()
Console.WriteLine("from inner method..")
End Sub
End Class
End Class
Module Module1

Sub Main()
Dim obj As New outerclass
Dim obj1 As New outerclass.innerclass

End Sub

End Module

The above code snippet shows how to use the inner class concept and how to access the functions/procedures
The “." Is used to access to the inner classes from outer class.
The code snippet defines 2 classes
1. Outer class with outer method
2. Inner class with inner method

In main method objects r created for both inner and outer classes


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: