7 Sep
2007
7 Sep
'07
7:15 p.m.
On 9/7/07, Brad Ryder
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