Angus Leeming <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>>>> I can see it is possible. Why is it 'preferable'?
>>>
>> | Free functions provide (often...) better encapsulation (Scott
>> | Meyers?).
>> 
>> Btu not if they operatoe on global variables... then you do not gain
>> anything.
>
| Where do you stand on the particular design under discussion?
>
| We're talking about free functions that provide access to a class's 
| member variables.

Free functions should ideally not access class variables,
the functions should be free only when they don't need access to the
class variables and only need the class's public interface for
implementation. (and then of course no class variables should be
public.)

This is the encapsulation part. (or course this can be simulated with
anon namespaces, but then the design is more "open" and access to the
variables are not as controlled.)

So, I guess, all in all I am more in favor of class variables than
variables in a anon namespace.


-- 
        Lgb

Reply via email to