Sunday, 28 April 2013

What is nested Classes ? | C#.Net Interview Questions

Nested classes are classes within classes. In sample below “ClsNested” class has a “ChildNested”
class nested inside it.
Public Class ClsNested
Public Class ChildNested
Public Sub ShowMessage()
MessageBox.Show(“Hi this is nested class”)
End Sub
End Class
End Class
This is the way we can instantiate the nested class and make the method call.
Dim pobjChildNested As New ClsNested.ChildNested()
pobjChildNested.ShowMessage()

No comments: