Partial template function specialization
Jarrett Billingsley
jarrett.billingsley at gmail.com
Thu Aug 20 09:04:15 PDT 2009
On Thu, Aug 20, 2009 at 10:34 AM, Bill Baxter<wbaxter at gmail.com> wrote:
> On Thu, Aug 20, 2009 at 7:22 AM, Peter
> Alexander<peter.alexander.au at gmail.com> wrote:
>> Lars T. Kyllingstad Wrote:
>> In my style of programming, I very rarely use member functions (I think they are an atrocity in language design), so I create global functions for almost everything, and when they need to access to private members, I have the class declare the function as a friend.
>>
>> Does D support my style of programming?
>
> Instead of friend, in D everything within one file (==one module) has
> access to everything else in that same file/module.
>
> So you can use your style, as long as you put the global functions in
> the same module as the classes operated on.
Alternatively, you can mark the data members 'package', and then any
functions in the same package can access them. But keep in mind that
'package' is limited in that you can't access those members from
sub-packages, meaning you are forced into a flat package hierarchy.
More information about the Digitalmars-d-learn
mailing list