Classes can have other classes nested within them. Functions and methods can have nested classes as well as nested functions. Typically, the inner classes and functions in a method are small and serve a purpose only in the context of the class in which they nest.
For example, in the following class definition, the class topclass has a member method, method () , which has an inner function, function (), which has an inner class, innerclassl. Notic e that topclass ha s a second inner class, innerclass2.
... class innerclassl:
... class innerclass2:
Was this article helpful?