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?
This is a discussion on Smart Pointer question within the C++ Programming forums, part of the General Programming Boards category; How are smart pointers used when the precise type of objects needed are unknown How would a shared_ptr or a ...
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.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way