What is local class in C++?
- Local class is defined within the scope of a function and nested within a function.
- It is declared inside a function and it becomes local to that function.
Example:int func1()
{
class localclass1
{.....};
}
- It cannot have static data members.
- Inside the local class, member functions must be defined.
- Automatic local variables cannot be used.