Not const method

Top  Previous  Next

Messages > Not const method

 

The message:

 

Not const method xxx called for const object XXX

 

appears, if the object XXX has been declared as const, but the method xxx of the object, would modify it.

 

Example:

 

In a function with the 

 

Parameter:  const mstrstr& xm

 

the cursor of xm shall be set to the next value:

 

xm.gotoNext();

 

But the cursor and its position "belong" to mstrstr. So the map would be modified by this action. The parameter has to be declared not const.

 

Parameter:  mstrstr& xm

 



This page belongs to the TextTransformer Documentation

Home  Content  German