On 2012-05-02 15:13:43 +0000, "Mehrdad" <[email protected]> said:

Yes, 'const' is part of the interface.

The trouble is that when you make it part of the interface, you're making the assumption that **no one** who derives from your class will need mutable state.

How can you ever guarantee that?

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. If the derived class casts away const, it breaks that contract.

--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to