Recommendation: If you’re not using make_shared to create the shared_ptr , at least create the object managed by the smart pointer in the same line of code – like :
shared_ptr<aircraft> pAircraft(new Aircraft("F-16")); </aircraft>
I think he really means to say that the second shared_ptr is better initialized from the first shared_ptr instead of the raw ptr.
Recommendation: If you’re not using make_shared to create the shared_ptr , at least create the object managed by the smart pointer in the same line of code – like :
shared_ptr<aircraft> pAircraft(new Aircraft("F-16")); </aircraft>
I think he really means to say that the second shared_ptr is better initialized from the first shared_ptr instead of the raw ptr.