Main Begins default constructor (Object 0 created) Before calling k1 Inside k1 Before returning something The returning variable would be created by copy constructor customized copy constructor (copying from Object 0 to Object 1) Destructor (Object 1 destroyed) The return variable is not stored and destroyed Entering Scope X Before calling k2 'a' would be created by the copy constructor with argument 'h0' notice: Object 0 is h0 customized copy constructor (copying from Object 0 to Object 2) Inside k2 notice: Object 2 is a Before returning something The returning variable would be created by copy constructor 'a' (Object 2) would be deleted when this function ends, because it was created as a result of pass-by-value customized copy constructor (copying from Object 2 to Object 3) Destructor (Object 2 destroyed) Creating dynamic variable and store its address in p1 using the copy constructor of abc customized copy constructor (copying from Object 3 to Object 4) The return variable is stored in h1 h1 (Object 3) would be deleted after scope X ended (Object 4) which is pointer to by p1 would not be deleted because it is created as dynamic variable End of this scope X Destructor (Object 3 destroyed) h0 (Object 0) would be deleted after the main scope ended End of this main scope Destructor (Object 0 destroyed)