Explain the effect of the second declaration in each one of the following sets of declarations. Indicate which, if any, are illegal.
(a)
int calc(int&, int&);
int calc(const int&, const int&);
(b)
int calc(char*, char*);
int calc(const char*, const char*);
(c)
int calc(char*, char*);
int calc(char* const, char* const);
(a)'s second declaration will declare a second function which accepts references
to const int
s. (b)'s second declaration will similarly declare a second
function which accepts pointers to const char
s. (c) is illegal, because it
declares two functions which accept pointers to char
s, which can both accept
const
pointers.