|
Boost : |
Subject: Re: [boost] [intrusive] rtti_base class proposition
From: Eugene Wee (crystalrecursion_at_[hidden])
Date: 2009-10-21 21:30:31
Hi,
On Thu, Oct 22, 2009 at 5:26 AM, Ireneusz Szpilewski
<irek_at_[hidden]> wrote:
>>> And how exactly are you supposed to make that change at runtime?
>>>
>
> What do you suggest?
>
> heart as a member of Me?
>
> Before:
>
> class Me
> {
> Â Â Â Â MyHeart heart;
> };
>
> After:
>
> class Me
> {
> Â SomebodyElsesHeart heart;
> }
>
> It can't be done at runtime either.
If MyHeart and SomebodyElsesHeart publicly inherited from say, a Heart
(abstract) base class, and if Me's heart member variable was a (smart)
pointer to Heart, then you could indeed change the actual (sub)type of
the Heart object that a Me object owns at runtime. This is a common
technique, methinks.
Regards,
Eugene
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk