The scope of the nested class is limited to the wrapper class. These two classes cannot be accessed outside of foo.
However, there is a difference between the classes s1 and s2. You cannot create s2 objects outside of foo.
You could create s1 objects outside of foo using the full name, as in Foo: s1 fs1; Classes that inherit Foo will be able to access s1, but not s2.
source
share