Are Local class, Inner class and Nested class mean same things in C++?
Are Local class, Inner class and Nested class are the same things in C++?
3.1k views Asked by user366312 At
3
There are 3 answers
0
On
Quoting draft of C++11 (N3290):
9.7 Nested class declarations [class.nest]
1 A class can be declared within another class. A class declared within another is called a nested class.
9.8 Local class declarations [class.local]
1 A class can be declared within a function definition; such a class is called a local class.
There is no concept of inner class specified in C++ standard.
Local Class and Nested class are different beasts.
A Nested class is a class declared within the scope of another class.
A Local class is declared within a function definition.
Inner class is a non standard C++ term, So I am not sure how to define it.
Nested Classes:
IBM Documentation as a nice documentation here.
To Summarize:
Local Classes:
This answer of mine here documents the subtle points associated with local classes.