It is very common interview question and the reasoning behind it is
- First two set of messages can't be overloaded since both the function will hold constant value. That's why C++ compiler will generate error message "re-definition is not allowed"
- While in the second case, both the functions have different significance . First prototype taking arguments which are pointer to integers while second one is taking arguments pointer to constant. Please find the example for second case.
int a = 10, b = 20;
int *ptr1 = &a;
int *ptr2 = &b;
const int c = 30, d =40;
int const *ptr3 = &c;
int const *ptr4 = &d;
fun1(ptr1 , ptr2);
fun2(ptr3, ptr4);