How to const declare the this pointer sent as parameter
- by Tomas
Hi,
I want to const declare the this pointer received as an argument.
static void Class::func(const OtherClass *otherClass)
{
// use otherClass pointer to read, but not write to it.
}
It is being called like this:
void OtherClass::func()
{
Class::func(this);
}
This does not compile nad if i dont const declare the OtherClass pointer, I can change it.
Thanks.