D
dean
We were working through one of Sutter's books this lunch time, and it
came about that you can put a function:
void f(int i); // in the header file
and
void f(const int i) {} // as the definition.
My question is: is that correct? Isn't the type const int different
from just int? I presume that inside function f, one could not change
i if it's marked as const in the declaration, even if its marked so
ONLY in the declaration.
-Thanks for reading!
-Dean
came about that you can put a function:
void f(int i); // in the header file
and
void f(const int i) {} // as the definition.
My question is: is that correct? Isn't the type const int different
from just int? I presume that inside function f, one could not change
i if it's marked as const in the declaration, even if its marked so
ONLY in the declaration.
-Thanks for reading!
-Dean