Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
June 12, 2013 Friend class and methods | ||||
---|---|---|---|---|
| ||||
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 Re: Friend class and methods | ||||
---|---|---|---|---|
| ||||
Posted in reply to Maxime Chevalier-Boisvert | 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 Re: Friend class and methods | ||||
---|---|---|---|---|
| ||||
Posted in reply to Maxime Chevalier-Boisvert | 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 Re: Friend class and methods | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | > 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 Re: Friend class and methods | ||||
---|---|---|---|---|
| ||||
Posted in reply to Maxime Chevalier-Boisvert | 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
|
Copyright © 1999-2021 by the D Language Foundation