File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -285,14 +285,15 @@ public:
285285};
286286
287287int main() {
288- Dictionary<char * , char * > * dict = new Dictionary<char* , char* >(10);
288+ auto dict = new Dictionary<char* , char* >(10);
289289 dict->print();
290290 dict->add("apple", "fruit");
291291 dict->add("banana", "fruit");
292292 dict->add("dog", "animal");
293293 dict->print();
294-
295- Dictionary<int, char* >* dict_specialized = new Dictionary<int, char* >(10);
294+ delete dict;
295+
296+ auto dict_specialized = new Dictionary<int, char* >(10);
296297 dict_specialized->print();
297298 dict_specialized->add(100, "apple");
298299 dict_specialized->add(101, "banana");
@@ -302,6 +303,7 @@ int main() {
302303 dict_specialized->sort();
303304 cout << endl << "Sorted list:" << endl;
304305 dict_specialized->print();
306+ delete dict_specialized;
305307}
306308```
307309
You can’t perform that action at this time.
0 commit comments