Hello everyone,
I am reading some code from other people, there are some code like this,
I want to confirm with you that it is not good code, since we return a reference to local object instance, right? Even if the code has expected function currently.Code:class Foo {
};
Foo& func()
{
Foo foo;
return foo;
}
int main()
{
Foo& foo = func();
return 0;
}
thanks in advance,
George