When should you use 'friend' in C++?

前端 未结 30 2203
孤街浪徒
孤街浪徒 2020-11-22 10:12

I have been reading through the C++ FAQ and was curious about the friend declaration. I personally have never used it, however I am interested in exploring the language.

30条回答
  •  鱼传尺愫
    2020-11-22 10:53

    Friend comes handy when you are building a container and you want to implement an iterator for that class.

提交回复
热议问题