Assume a copy ctor is made.
demo fun(demo X){
//returning and passing new objects
return X;
}
int main(){
demo A;
A = fun(A);
return 0;
}
My question is mostly in the fun method. I assume X is bounded by the scope, and am I correct in assuming a copy ctor is called at the return statement? Or is demo X created when it's passed as an argument in the main method?
If X is confined to the fun method, is a temp Demo object assigned to A in the main method? And when would that temp destructor be called?
This is rather confusing

New Topic/Question
Reply



MultiQuote





|