$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-09-07 15:15:55
On 9/7/07, Brad Ryder <bradryder67_at_[hidden]> wrote:
>
> main()
> {
> A base;
> shPtrB spB(new B());
> shPtrC spC(new C());
>
> // I dont want to typecast spB or spC
>
> A.AddChild( (shPtrA) spB);
> A.AddChild( (shPtrA) spC);
> }
Simply stop using shPtrB and shPtrC, and just use shPtrA. e.g.,
main()
{
A base;
shPtrA spB(new B());
shPtrA spC(new C());
// works fine
A.AddChild(spB);
A.AddChild(spC);
}
HTH,
--Michael Fawcett