Boost logo

Boost Users :

From: Andy Rushton (quergle-mingw_at_[hidden])
Date: 2008-07-05 12:06:51


No, as I read it, the original author was not interested in covariant
return types, he was asking how to solve the problem of writing clone
methods for polymorphic classes. The solution is to *not* use covariant
return types. This avoids the problem where shared_ptr<A> is a
completely different and non-castable type to shared_ptr<B> - but if you
do it the non-covariant way you don't have this problem because all your
clone functions return shared_ptr<A>. Problem solved.

You'll get further in life if you make positive contributions, rather
than putting down other people's.

Rodolfo Lima wrote:
>
> And apparently you've forgotten what covariant return types are :)
>
> Regards,
> rod


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