Boost logo

Boost :

From: Edward Diener (eldiener_at_[hidden])
Date: 2007-03-25 16:13:47


Julio M. Merino Vidal wrote:
> Hello,
>
> [ I'm not sure this really belongs to this list (as opposed to some C+
> + generic list), but as it is related to some comments I received a
> while ago from this list, I'm posting it here. ]
>
> Back when I presented Boost.Process 0.1 past year, I used getters for
> all class members that had to be exposed to the library user.
>
> However, some reviewers commented that it was "ugly" to provide
> getters that just returned a member's value. I tried to change most
> of those instances to constant members that could be queried
> directly, but I still have doubts whether that was the correct way to
> go.
>
> Here are my reasons supporting getters: snip...

Getters are far superior to const members for all the reasons you cited,
plus this one: often data does not reside as a member of an object but
must be created at run-time when requested. This last is a perfectly
logical reason for getters, and for the 'property' notion in general.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk