A class defined within another class is called nested. By default, the nested class is private.

class Container  
{
class Nested
{
// Add code here.
}
}

To create an instance of the nested class, use the name of the container class followed by the dot and then followed by the name of the nested class:


Container.Nested nestedInstance = new Container.Nested()  

Last modified: March 20, 2019

Author

Comments

Write a Reply or Comment