Summary
This episode explores covariant return types in C++, which allow a derived class to override a virtual method with a more specific return type. Jason demonstrates how covariance works with pointers and references to polymorphic types, but highlights a key limitation: it doesn't work with value returns or smart pointers. He then explores a potential solution by designing a custom covariant smart pointer wrapper that maintains the inheritance relationship while providing memory management benefits.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[facet.ctype.char.virtuals]59% match