|
Boost : |
Subject: Re: [boost] the best possible c++ properties (implementation).
From: Pierre Morcello (pmorcell-cppfrance_at_[hidden])
Date: 2010-03-01 16:58:16
First quote :
> > In order for a property ("Age" in the original
> example) to be able to reference other properties/members of
> its containing class, it needs a pointer to the object
> containing it.
> >
Second quote :
> If
> the setter/getter of property A needs to
> maintain invariants on other properties then I fail to see
> how your property system would handle it.
Hello,
You might want to give a glimpse at this previous thread :
"[boost] [property] interest in C# like properties for C++?".
1/ you will see an interesting use of the defect 45 (<=> subclasses can access private members of parent class). More traditionnally, a friend might also have been used.
2/ no 'directly' stored pointer (recalculated at each access).
3/ lots of discussions on the subject.
http://lists.boost.org/Archives/boost/2009/10/157143.php
Best Regards,
Pierre Morcello
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk