Re: [Boost-users] shared_ptr and inheritance of the raw pointer
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Yossi.Itzkovich@ecitele.com Sent: Wednesday, July 26, 2006 3:03 AM To: boost-users@lists.boost.org Subject: [Boost-users] shared_ptr and inheritance of the raw pointer
I have this code:
#include
class A{ // base class public: virtual ~A(); // otherwise A isn't polymorphic, can't downcast };
class B : public A{ public: int b1; };
typedef boost::shared_ptr<A> tSmartA; typedef boost::shared_ptr<B> tSmartB;
void foo (const tSmartB& smartOne); // need ; for syntax ^^^^^ permits passing an expression
int main () { tSmartA a(new B); foo(boost::dynamic_pointer_cast<B>(a)); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return 0; }
How can I then send a to foo() ?
[Nat] With the three changed lines shown above, this compiles for me under MSVC 7.1.
participants (1)
-
Nat Goodspeed