#include
#include
#include
using namespace std;
string foo()
{
//string t = "asfds";
return "asfds";
//return t;
}
void bar(string &s)
{
cout << s << endl;
}
int main()
{
bar(foo());
system("pause");
return 0;
}
为什么可以运行,foo函数返回的临时变量不是会被释放掉的吗,bar函数的参数s是哪个变量的引用