Arne... This code looks a bit suspect to me as it uses inheritance, not
containment. This is what the docs say:
==== snip =====
A collection that is read-only does not allow the addition, removal, or
modification of elements after the collection is created.
A collection that is read-only is simply a collection with a WRAPPER
that
prevents modifying the collection; therefore, if changes are made to the
underlying collection, the read-only collection reflects those changes.
=====/snip=======
http://www.parashift.com/c++-faq-lit...heritance.html
[21.1] Should I hide member functions that were public in my base class?
Never, never, never do this. Never. Never!
Attempting to hide (eliminate, revoke, privatize) inherited public
member
functions is an all-too-common design error. It usually stems from muddy
thinking.
More at:
http://c2.com/cgi/wiki?LiskovSubstitutionPrinciple
Regards,
Jeff
If you want an "immutable" HashTable then darive a new Class from
HashTable
and override the IsReadOnly-Property.
public override void Add(object key, object value)
{
if (_IsReadOnly)
{
throw new Exception("ReadOnly!");
}
base.Add (key, value);
}
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!