August 2012
Intermediate to advanced
976 pages
30h 17m
English
A class can be defined inside a function body. Such a class is called a local class. A local class defines a type that is visible only in the scope in which it is defined. Unlike nested classes, the members of a local class are severely restricted.
Note
All members, including functions, of a local class must be completely defined inside the class body. As a result, local classes are much less useful than nested classes.
In practice, the requirement that members be fully defined within the class limits the complexity of the member functions of a local class. Functions in local classes are rarely more than a few lines of ...
Read now
Unlock full access