Thread overview
Friend class and methods
Jun 12, 2013
David Nadlinger
Jun 12, 2013
Adam D. Ruppe
Jun 12, 2013
Ali Çehreli
June 12, 2013
Does D have something like the concept of friend classes and functions in C++? I'd like to have a function that can access private members of two classes at the same time.
June 12, 2013
On Wednesday, 12 June 2013 at 19:01:24 UTC, Maxime Chevalier-Boisvert wrote:
> Does D have something like the concept of friend classes and functions in C++? I'd like to have a function that can access private members of two classes at the same time.

No (t really), you have to stick the two classes into the same module.

David
June 12, 2013
On Wednesday, 12 June 2013 at 19:01:24 UTC, Maxime Chevalier-Boisvert wrote:
> Does D have something like the concept of friend classes and functions in C++?

The closest is to put both classes and the function in the same module. Things all in the same module can see the private members of each other.

June 12, 2013
> The closest is to put both classes and the function in the same module. Things all in the same module can see the private members of each other.

Good enough for my needs. Thanks.
June 12, 2013
On 06/12/2013 12:12 PM, Maxime Chevalier-Boisvert wrote:
>> The closest is to put both classes and the function in the same
>> module. Things all in the same module can see the private members of
>> each other.
>
> Good enough for my needs. Thanks.

Sometimes 'package' is more suitable than 'private'.

Ali