Top "Friend" questions

In object-oriented programming, friend refers to a method or class that has access to some non-public aspects of a particular class.

Are inner classes in C++ automatically friends?

If I define an inner class in C++, is it automatically a friend of the class that contains it? For …

c++ friend nested-class
How to propagate friend for derived classes

I want to have a class hierarchy and be able to create objects from it only inside a Factory. Example: …

c++ friend
C++ template friend operator overloading

What is wrong with my code? template<int E, int F> class Float { friend Float<E, F&…

c++ templates operator-overloading friend
VB.NET: what does the 'friend' modifier do?

What does the 'friend' modifier do in VB.NET? Why is it the default modifier for GUI components in Visual …

vb.net user-interface oop friend
Is there any way to access private fields of a struct from another package?

I have a struct in one package that has private fields: package foo type Foo struct { x int y *Foo } …

go package private friend
What is wrong with making a unit test a friend of the class it is testing?

In C++, I have often made a unit test class a friend of the class I am testing. I do …

c++ unit-testing oop encapsulation friend
PHP equivalent of friend or internal

Is there some equivalent of "friend" or "internal" in php? If not, is there any pattern to follow to achieve …

php oop friend
friend AND inline method, what's the point ?

I see in a header that I didn't write myself the following: class MonitorObjectString: public MonitorObject { // some other declarations friend …

c++ methods inline friend
"Friend"ing classes in python

Is there any way to make certain variables in classes "private" (or whatever self.__var really is) but be accessible …

python class inheritance friend
a class-key must be declared when declaring a friend

The g++ compiler complains with this error when I declare a friend thusly: friend MyClass; instead of friend class MyClass; …

c++ friend