Create an object/Native demonstration: Difference between revisions

Content added Content deleted
(Added C++ implementation)
(Clarified task wording)
Line 1: Line 1:
{{draft task}}
{{draft task}}


Create a Hash/Associative Array/Dictionary-like object, initialized with some default key/value pairs using the languages native method of object creation. The object should behave like a native Hash/Associative Array/Dictionary of the language, if any, but with the following differences:
Create a Hash/Associative Array/Dictionary-like object that can be initialized with key/value pairs. The object should behave like a native Hash/Associative Array/Dictionary of the language, but with the following differences:


* No new item can be added;
* No new keys can be added;
* Keys cannot be removed;
* Item cannot be deleted, (but native delete method may used to reset the item's value to default) ;
* A key can be reset its original initialized value.

If the language supports '''Magic Methods''', then show how these work.


=={{header|C++}}==
=={{header|C++}}==