All challenges
Multiple ChoiceHard 45s

shared_ptr aliasing constructor

What is the purpose of the `shared_ptr` aliasing constructor `shared_ptr<T>(const shared_ptr<U>& owner, T* ptr)`?
Options
  1. 1It creates a second, independent control block for the same object, giving two unrelated owner counts.
  2. 2It casts the stored pointer to an unrelated type and transfers ownership of that pointer to the new instance.
  3. 3It deletes the original owner's control block and then adopts its raw pointer under a fresh control block.
  4. 4It shares ownership of owner's object (keeping it alive) while pointing at a different sub-object `ptr`.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle