How to create friends of a class at compile time?
Steven Schveighoffer
schveiguy at gmail.com
Thu Jul 15 18:06:26 UTC 2021
On 7/15/21 1:43 PM, Tejas wrote:
> How do you write the equivalent of that in D? Is the answer still the
> same? Manually keep it in the same module, or is there a programmatic
> way of converting this to D?
Functions in the same module can access `private` members. Functions in
the same package (or in whatever package you specify) can access
`package` members. That is how D does "friends".
So the answer to your question depends on how the C++ code is organized.
It's always possible that something in C++ here is not translatable into
D, but most likely can be redesigned (and likely better designed).
-Steve
More information about the Digitalmars-d-learn
mailing list