When you use smart pointer. Here I change it to another question, When
you use new
An new object remain in existence, until you delete it. (you control
the life time of it, maybe you create it in fun1,then delete it in
fun4. so the obj is neither stack life nor global life. You may or
may not transfer ownership between functions.)
When you want to dynamic create a obj in runtime according runtime
condition or user input. (maybe don’t create it. ) Below code
demonstrate previous two conditions. ToothBrush need to be control
life time and created dynamically.