I was looking at some C++ code and I notice that a function had const at the end of it. I have ask and ried to research, but haven't gotten a good answer for why you would use const that way. Example below.
in header file
int myFunction(int &i, const int j, const int x) const;
in source file
int myFunction(int &i, cont int j, const int x) const
{
do some stuff
return val;
}
Why is there const at the end of the function and what will it gain you?