Why D const is annoying

Jacob Carlborg doob at me.com
Wed May 2 14:05:29 PDT 2012


On 2012-05-02 20:58, Mehrdad wrote:
> Er, I guess I didn't say what I actually meant to say, my bad. x_x
>
> What I meant that you're assuming that derived classes won't need
> mutable state in an const method that they overrode.

Yes, that would be the assumption. It's not possible without subverting 
the type system. It's like saying "I'm overriding this method but I want 
it to return an int instead of a string". It's part of the interface.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list