PuzzleCracker... As Peter suggest you can use an immutable class.
If you simply want to keep a particular client from modifying the class,
wrap the
mutable class in a read only wrapper so that the client cannot directly
modify
the encapsulated mutable class and pass a reference of type immutable
wrapper
to the client. This is the strong guarantee. The generic collections,
for instance,
have a method AsReadOnly() that returns an object reference that
implements
the read only IList interface.
Finally a kludge is to design an inheritance hierarchy with a read only
base class
and a read write sub class. Create an instance of the read write sub
class and
then create a reference variable of type read only base class. Pass the
reference
of type read only base class to the client. This is the weak guarantee,
since the
client can still cast the read only reference to the read write sub
class type.
Regards,
Jeff