#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
int b = 666;
int&c = b;
int&d = c;
d++;
cout << &b << ' ' << &c << " " << &d <<endl;
cout << d << endl;
int const& e = d;
cout << &e << endl;
// d = 20;//对只读赋值
int const& r = 10;//可以取地址的是左值,不能取地址是右值
cout << r << endl;
int const& f = c + b;
cout << f << endl;
// int m = 0;//引用必须初始化
// int& n;
// n = m;
return a.exec();
}
qt开发环境 - c++引用
最新推荐文章于 2024-04-07 11:46:43 发布