Transitive Const in OO programming

Sean Kelly sean at f4.ca
Wed Aug 8 13:19:20 PDT 2007


Alex Burton wrote:
> Regan Heath Wrote:
> 
>> It seems making StateMachineWrapper::getResult non-const solves the problem.
> 
> Yes it would but then I can't simply call a get method (getResult) using a const reference to StateMachineWrapper.

Because getResult modifies the state of the object?  Given this 
particular use case, I think I'd want to be aware of the 'destructive' 
behavior of getResult.  I have found uses for 'mutable' in the past, but 
mostly for things like mutexes for synchronizing data access rather than 
the data itself.


Sean



More information about the Digitalmars-d mailing list