<s>[INST] ### INNER CLASS IN C++ 
# inner-class-in-cpp
Implementation of inner-class in C++
================================WebKitForm-blind.setdefaultAttribute()
===================================

```cpp
#include <iostream>
#include <string>

class Outer {
private:
    std::string outerData;

public:
    Outer(std::string o) : outerData(o) {
        //cout << "Outer Class Object has been created" << endl;
    }

    class Inner {
    private:
        std::string innerData;

    public:
        Inner(std::string i) : innerData(i) {
            //cout << "Inner Class Object has been created" << endl;
        }

        void print() {
            std::cout << outerData << std::endl;  // error: 'outerData' is not accessible from 'Outer::Inner'
        }
    };
};

int main() {
    Outer out("outer");
    Outer::Inner in("inner");
    // This will create an instance of the inner-class
    in.print(); // to print

    return 0;
}
```

Inner Class: An inner class in C++ is a nested class that has access to the outer class, whereas the outer class does not have access to the inner class. The purpose of an inner class is to encapsulate useful functionality in a robust manner.

### Can a class in C++ have an Inner Class which have different access specifier like public,private etc. Than its Own Access Specifier?[/INST]