Is it possible to have a private class?

前端 未结 4 1292
隐瞒了意图╮
隐瞒了意图╮ 2021-01-12 13:40

I always wonder if it is possible to have a private class? And, what would be the point of having such class?

Thanks for helping.

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 14:10

    You can have a private class, inside another class.

    You may use a private class to encapsulate logic and implementation. For example you can declare an implementation of an iterator in your implementation of ICollection.

提交回复
热议问题