J
Jianwei Sun
I am reading a peice of code which is at the following link:
http://www.brpreiss.com/books/opus4/html/page141.html#SECTION007123000000000000000
The code is like this:
Object& StackAsLinkedList:op()
{
if(count==0)
throw domain_error("stack is empty");
Object& const result=*list.First();
list.Extract(&result);
--count;
return result;
}
Does this code return a reference to local variable result? If this is the
case, then this code
has problem?
Thanks,
J.W.
http://www.brpreiss.com/books/opus4/html/page141.html#SECTION007123000000000000000
The code is like this:
Object& StackAsLinkedList:op()
{
if(count==0)
throw domain_error("stack is empty");
Object& const result=*list.First();
list.Extract(&result);
--count;
return result;
}
Does this code return a reference to local variable result? If this is the
case, then this code
has problem?
Thanks,
J.W.