In this code:
RationalNum operator+(const RationalNum& left, const RationalNum& right) {
RationalNum temp;
/*code here*/
return temp;
}
How can it return a RationalNum object if the object is "deleted" from the stack when this function exits?
RationalNumclass follows the rule of 3 /5 /0.deleted in stack, but they are destructed when they are out of scope?int foo() { int i = 10; return i;}returns10, even though "i" is "deleted".tempwill never actually be created in the function's stack frame at all. If you were returning a pointer or reference, you'd be in deep doo doo.