Boost logo

Boost Users :

From: divyank shukla (divyank_s_at_[hidden])
Date: 2006-07-26 03:51:58


Hi
 You can use explicit converters

regards
  divyank

--- Yossi.Itzkovich_at_[hidden] wrote:

>
> 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 mailing list
> Boost-users_at_[hidden]
>
http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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