As I understand it: in ex 1, an object is created in dynamic memory and given the name temp. It's assigns the data members to 4 and 7 according to the constructors.
return does it's work.
in ex 2 seems like it's doing the same with with out assigning it a name?
helios is right. Your functions both use stack allocation. Check this out, it demonstrates that heap (dynamic) memory allocation takes place in a different place than stack allocation. It also demonstrates that your two functions use the same allocation method.