4
I came across this piece of code in a material:
class Foo
{
public:
int Bar(int arg1) const //<-- qual função do const aqui?
{
// código a ser implementado aqui
}
};
[1] Like the const
affects this method statement Bar
?
[2] What is the difference between these statements?
const int * ptrInt1;
int const * ptrInt2;
[3] The method with const
in the argument, it is for that parameter forced to be read-only in the code implementation?
int Foo (const int Bar) //<-- const antes de argumento na função
{
// código a ser implementado aqui
}