Boost logo

Boost Users :

From: Yossi.Itzkovich_at_[hidden]
Date: 2006-07-26 03:03:04


Hi,
I have this code:

#include <boost/shared_ptr.hpp>

class A{ // base class
public:
};

class B : public A{
public:
  int b1;
};

typedef boost::shared_ptr<A> tSmartA;
typedef boost::shared_ptr<B> tSmartB;

void foo (tSmartB& smartOne) // should get a pointer to derived
{ }

int main () {
  tSmartA a(new B);
  foo(a); // This line doesn't compile because foo expects to get tSmartB
  return 0;
}

How can I then send a to foo() ?

Thanks

Yossi


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net