Compiler Error C2662

'function' : cannot convert 'this' pointer from 'type1' to 'type2'

The compiler could not convert the this pointer from type1 to type2.

This error may be caused by invoking a non-const member function on a const object. To correct the problem, remove the const from the object declaration or add const to the member function.

The following is an example of this error:

class C
{
public:
   void func1();
   void func2() const;
} const c;

void main()
{
   c.func1();  // error
   c.func2();  // no error
}