Unofficial wish list status.(Jul 2008)
Russell Lewis
webmaster at villagersonline.com
Thu Jul 24 15:10:53 PDT 2008
Don wrote:
> I'm not sure why you wouldn't just make two classes, and apply invariant
> at the class definition level.
As I understand it, the difference is that you can only call invariant
functions on an invariant object. So, if you have a reference to the
class, and the reference is marked invariant, then all of the
non-invariant functions can't be called.
Why would you have an invariant object, you say? Well, a basic example
is where you create an object, initialize it, then cast it to invariant.
(Presumably, you can guarantee, that it is invariant from the moment
of the cast until the program dies.)
More information about the Digitalmars-d
mailing list