#include <iostream>
using namespace std;
void f(int& a)
{
cout << "void f(int& a)" << endl;
}
void f(const int& a)
{
cout << "void f(const int& a)" << endl;
}
int main()
{
int a = 6;
int &b = a;
const int c = 8;
f(a);
f(b);
f(c);
f(3);
return 0;
}
运行结果:
void f(int& a)
void f(int& a)
void f(const int& a)
void f(const int& a)