If I do this:
// In header
class Foo {
void foo(bar*);
};
// In cpp
void Foo::foo(bar* const pBar) {
//Stuff
}
The compiler does not comp
It probably doesn't care much about void Foo::foo(bar* const pBar)
because how you treat the pointer itself (const or not) doesn't matter one bit outside of the routine. The C rules say that no change to pBar will travel outside of foo either way.
However, if it is (const bar* pBar)
, that makes a difference, because it means the compiler is not to allow callers to pass in pointers to non-const objects.