Compiler Error 315
"Error: The object has type qualifiers that are not compatible with the member function in ..."
This error is usually asserted when you try to do an operation that is not supported by a type instance implementation but is in the type definition. Usually related to incorrect const usage.
The best example is calling a non-constant method of a constant object. The compiler thinks the methods will modify the object in some way which is not allowed. In this case you have 3 possible solutions.
- Define the method as constant. This imposes implementation limitations that it cannot modify any object member but allows it to work on constant object instances. Eg change the member "void foo()" to "void foo() const".
- Strip the object instance implementation of its constant type. If you need to change an object then it should not be constant in the first place.
- Limit all method calls on the object instance implementation to constant ones. If you do not need to change an object then you should not call methods to do so.