Presumably deviceContext
is a pointer data member, so a const
method cannot modify the pointer. But is is allowed to modify the object the pointer points to:
struct Bar {
void bar() {} // non const method
};
struct Foo {
Foo() : p(0) {}
void foo() const { p->bar();} // const method calling non-const method of Bar
Bar* p;
};
int main()
{
const Foo f;
f.foo(); // OK, Foo::p is not modified
}