Boost logo

Boost :

Subject: Re: [boost] [intrusive] rtti_base class proposition
From: Eugene Wee (crystalrecursion_at_[hidden])
Date: 2009-10-21 21:30:31


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.


Boost list run by bdawes at, gregod at, cpdaniel at, john at