
21 Jan
2005
21 Jan
'05
10:54 p.m.
Hello NG, With regard to shared_ptr<>... Let's say I have a heap object of type O that contains one subobject of type SO. At this point, I'm deliberately not saying whether the subobject is brought into the object by public inheritance or by containment. Either way, the memory layout is the same under most implementations. May I upcast shared_ptr<O> to shared_ptr<SO> in any case? Or, does the answer depend on whether the subobject has been brought in by public inheritance or by containment? Same question for a downcast (dynamic cast)... Thanks, Dave