左值与右值
https://www.cnblogs.com/catch/p/3500678.html
引用与右值引用
https://blog.youkuaiyun.com/weixin_40539125/article/details/84107068
#include <iostream>
double cube(double a);
double refcube(double &ra);
int main ()
{
using namespace std;
double x = 3.0;
cout << cube(x);
cout << " = cube of " << x << endl;
cout << refcube(x);
cout << " = cube of " << x << endl;
// cin.get();
return 0;
}
double cube(double a)
{
a *= a * a;
return a;
}
double refcube(double &ra)
{
ra *= ra * ra;
return ra;
}
输出:
27=cube of 3
27 = cube of 27