C++ - What's the point of nested classes?

前端 未结 3 1916
星月不相逢
星月不相逢 2021-02-01 15:04

I\'m studying a little of C++ and now I\'m fighting against it\'s similitudes with Java. I know the purpose of inner classes in Java, but now I\'m trying to use nested classes i

3条回答
  •  隐瞒了意图╮
    2021-02-01 15:15

    It provides another good encapsulation technique. Placing one class entirely within the namespace of another class reduces its visibility to other parts of your code base. This helps achieve scalability and reduces your maintenance burden.

    Function objects are often coded in such a manner.

提交回复
热议问题