|
|
|
|
|
by MatthewCampbell
5279 days ago
|
|
We're going too deep into this, for alexgartrell's relatively simple claim that covariant return types have a reason for being in the language, and that smart pointers omit that capability. But just to clarify: no base class implementation is aware of derived classes in the copying case, so your smell doesn't exist. See Scott Meyers' "virtual copy constructor" snippet half way down the page:
http://books.google.com/books?id=azvE8V0c-mYC&lpg=PT159&... You can't do it that neatly without covariant return types. Ergo, you can't do that while returning safe, smart pointers. |
|