David
Thu Dec 06 02:25:58 PST 2007
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:u0g%23Iy7NIHA.3516@TK2MSFTNGP02.phx.gbl...
> As to static: again, the reason to declare a field 'mutable' is to be able
> to modify it even in an object declared const. But a static field is not
> tied to any particular object, so it doesn't magically become const if you
> declare the containing object const (there's no containing object). So
> there's no reason to declare it mutable: just don't make it const, and you
> can always modify it.
Are you saying that a const member function of a class *can* change static
data members of the class?
[I ask out of interest: it isn't something I've ever thought to try.]
[I do use mutable data members, though I know that some think of them as a
betrayal of object orientation. I think of them as sort of 2nd class
citizens: things which it is convenient to have there, but whose value does
not really change the nature of the object. For example some of my objects
have CDC * members which are mutable, so that it can acquire a DC and draw
itself and then lose the DC - it saves passing them as arguments through
multiple tiers of drawing code.]
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm