How do the compiler choose the right overloadedfunction

Helle there,

i got a question about the compiler.
If i have two function:
1) int foo (char a, int b);
2) int foo (int a, int b);

The compiler can differ the functions by the parameter. So far, so good.

But what is it about that two (member-)functions:
1) int& bar (int a);
2) const int& bar (int a) const;

How can it differ these functions?

Last edited on
It doesn't. The following won't compile:

int& bar (int a);
const int& bar (int a) const;
int main()

The compiler complains about non-member functions with const qualifiers and being unable to tell the two functions apart.
And if it is a Memberfunktion?
I ask because i read the stl-vector reference ("at"-function)
Topic archived. No new replies allowed.