Why D const is annoying
Mehrdad
wfunction at hotmail.com
Wed May 2 09:01:48 PDT 2012
> When you're making the object 'const', you're not making the assumption
> that no one who derives from this class need mutable state.
> What you're doing is asserting that bits belonging to this object needs to
> be 'const' to preserve sequential consistency across threads or for other
> reasons.
Bits belonging to *this* object? I thought const was transitive...
> If the derived class casts away const, it breaks that contract.
So you're saying the same thing: Derived classes CANNOT have mutable
state...
More information about the Digitalmars-d
mailing list