local class in C++

A class declared inside a function becomes local to that function and is called local class in C++. A class declared inside a member function in another class is also a local class in C++.
* A local class name can only be used locally i.e., inside the function and not outside it.
* The methods of a local class must be defined inside it only.
* A local class can have static functions but, not static data members.
* Member methods of the local class can only access static and enum variables of the enclosing function. Non-static variables of the enclosing function are not accessible inside local classes.

```
#include <iostream>
using namespace std;


void f() {
    class A {
        int val;
    public:    
        A(int val) { this->val = val; }
        void af() { cout << val << endl; }
    };

    A a(5);
    a.af();
}

int main()
{
    f();
}
```