Can't use public nested class as private method parameter

13

In the following code:

class Outer {
   private:
    void f_private(Outer::Inner in); // Wrong

   public:
    class Inner {};
    void f_public(Outer::Inner in); // OK
};

f_private() cannot use nested class Outer::Inner as parameter type. But it's ok to do so in f_public().

Can someone explain to me in what rule this is based on, and what's the benefit it?

Share
Improve this question
0

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

React Native - Image Cache