Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-08-02 17:40:44


Fernando Cacciola wrote:
> "Aleksey Gurtovoy" <agurtovoy_at_[hidden]> escribió en el mensaje
news:045f01c3587c$5fa650b0$9a44a8c0_at_metacomm.com...
> > David Abrahams wrote:
> > > Here's an example I just cooked up of using the PP lib to solve a
> > > classic C++ OO problem: repeated boilerplate in the definition of
> > > Pimpl classes.
> >
> > There is another variation of the idiom, sometimes called "hidden
state",
> > which doesn't have the shortcoming in the first place:
> >
> A shortcoming of the hidden state idiom compared to the classic delegation
> idiom is that only the state is encapsulated, not the behaviour.

I am not sure what do you mean by "encapsulated". Hidden in a source file as
opposite to the header?

> IOWs, if you need to hide the operations, not just the state, you still
> need to mirror the interface class member functions into
> the impl class.

How so? With the hidden state, what would be private member functions
becomes free functions at the file scope. You just call those directly from
anywhere within the file scope, without the boilerplate forwarding.

Aleksey


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