Skip to content

Commit 4ce5bc7

Browse files
authored
Update template-specialization-cpp.md
1 parent bee564d commit 4ce5bc7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/cpp/template-specialization-cpp.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,15 @@ public:
285285
};
286286

287287
int 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

0 commit comments

Comments
 (0)