From: rz0 [mailto:rz0@yahoo.com]
VC++ 6.0 flags the above lines with a conversion error.
Is there any way to resolve this?
Can you just define b and c as boost::shared_ptr<A>?
Hi Jon
Thank you very much for the response. Unfortunately this will cause the same problem that I ran into with std::auto_ptr and that is methods funcB and funcC which are exclusive to B and C are not allowed to be called.
Take care RZ
It seems to me that the problem is in the design - you're trying to use inheritance for the convenience of placeholding (and maybe insulation). That won't work (as you've seen). Even with a compiler that allows the code to compile (those that support member templates will) you will not get the behaviour that you want - funcB and funcC can never be called (from client code). The reason that the code compiles cleanly is that the conversion from B* or C* to A* is valid - but there's no way you can dynamically change the static type of "boost::shared_ptr<A> aptr;". If you really need to get this to work, it is still possible: You could use boost::any, and any_cast through all the possible types. This, however, is not very flexible, and IMO not very readable or maintainable. Regards, Bjorn Karlsson [Non-text portions of this message have been removed]