From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Hughes, James Sent: May 1, 2007 5:19 AM To: Boost-users@lists.boost.org Subject: [Boost-users] [Shared_ptrs] As I doing this right
Although I have been using shared_ptr's for a while, I still get a bit confused with polymorphic stuff ...no change there.
An pseudocode example:
Class A { };
Class B : public A { DoStuff1(); DoStuff2(); DoStuff3(); DoStuff4() };
This is not polymorphic. To make this example polymorphic you need to declare the functions virtual in class A.
So, the quesiton is one of efficiency - if I was using pointers, I would just new a B and assign to a B* variable, then pass in to the function which would use it as an A - no temp required.
This requires that the functions be declared in A. If you do that, your example will work with either raw pointers or shared_ptr's. Jules.