- #1
MinusTheBear
- 22
- 0
Hey all,
I'm reviewing for a data structures exam and covering stuff from the previous course. I am a little confused about something between the book and what my professor says.
If I have the following prototypes:
int sum(int a, int b);
void sum(int a, int b);
int sum(int&a, int&b);
So, I know this will create a compilation error because the compiler won't be able to disambiguate between the signatures. However, I want to be sure I understand something. The first two functions have the same signature, while the third one has a different signature since it is pass-by-reference, correct? However, in the case of the third function, even though it's a different signature, the compiler won't be able to disambiguate the function calls so it'll cause a compilation error even if we were to remove one of the first two functions.
Is all of that correct?
I'm reviewing for a data structures exam and covering stuff from the previous course. I am a little confused about something between the book and what my professor says.
If I have the following prototypes:
int sum(int a, int b);
void sum(int a, int b);
int sum(int&a, int&b);
So, I know this will create a compilation error because the compiler won't be able to disambiguate between the signatures. However, I want to be sure I understand something. The first two functions have the same signature, while the third one has a different signature since it is pass-by-reference, correct? However, in the case of the third function, even though it's a different signature, the compiler won't be able to disambiguate the function calls so it'll cause a compilation error even if we were to remove one of the first two functions.
Is all of that correct?