How are smart pointers used when the precise type of objects needed are unknown
How would a shared_ptr or a unique_ptr resolve this? What about the class weak_ptr which is a weak reference to a shared_ptr?
Printable View
How are smart pointers used when the precise type of objects needed are unknown
How would a shared_ptr or a unique_ptr resolve this? What about the class weak_ptr which is a weak reference to a shared_ptr?
As in when you have a polymorphic base class, but the exact derived class types will only be known at runtime? The solution is to use a smart pointer of the base class type then.