[fpc-devel] "Friend" classes?

DrDiettrich drdiettrich at compuserve.de
Tue Mar 15 00:58:57 CET 2005

I just came about code that uses protected members of other classes,
defined in other units. In Delphi this possible by a declaration like:

type TFriendClass = class(TNotMyClass);

After this declaration the protected (and private?) members of
TNotMyClass are accessible, using TFriendClass as an type alias.

Now my questions:

1) Is such behaviour also available with FPC? In non-Delphi modes?

2) How portable are such "friend" classes? Does there exist some (other)
standard for this purpose?

3) What alternatives could be used, so that not all class members must
be made public, when they shall be used only in specific related units?


More information about the fpc-devel mailing list