void test(int& i) { } void constRefTest(const int& i) { } int main() { int i = 8; // test(2); // 错误 test(i); // 正确 constRefTest(6); // 正确,隐式转化 constRefTest(i); // 正确 return 0; }
65,187
社区成员
250,526
社区内容
加载中
试试用AI创作助手写篇文章吧