MUTABLE_CAST macroIn the example code below, the class has a simple const getter function Var(). It uses MUTABLE_CAST to cast away the const-ness of the counter variable iGetCounter, which allows that variable to be changed.
class TMutableDemo
{
public:
TMutableDemo(TUint a=0):iVar(a),iGetCounter(0) {};
TUint Var() const;
private:
TUint iVar;
__MUTABLE TUint iGetCounter;
};
TUint TMutableDemo::Var() const
{
MUTABLE_CAST(TMutableDemo*,this)->iGetCounter++;
return iVar;
}