Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • @all : Awesome answers and comments, This is such a great way to learn, there's no way i'd have learned about friends in such details in a textbook. Commented Sep 4, 2011 at 18:56
  • 1
    see: programmers.stackexchange.com/questions/99589/… Commented Sep 4, 2011 at 19:58
  • In terms of "bypassing the security", they can only be declared to be friends inside the scope of the class definition, which is the same as methods really - and their ability to see private members inside the class is also the same as for methods. So it's for giving functions which aren't called in the same was as a method the ability to see inside objects of a class in the same way as a method. Commented Aug 20, 2021 at 7:13