diff --git a/Foundation_Classes/List.cpp b/Foundation_Classes/List.cpp index 1b8c6b4..9c4f648 100644 --- a/Foundation_Classes/List.cpp +++ b/Foundation_Classes/List.cpp @@ -12,7 +12,18 @@ List::List(long size) : _size(size), _count(0) { _items = new Item[size]; } -// TODO: Copy constructor. +// Overrides the default copy constructor so that member data are initialized properly. +template +List::List(List& other) { + _size = other._size; + _count = other._count; + + _items = new Item[_size]; + + for (long i = 0; i < _count; ++i) { + _items[i] = other._items[i]; + } +} template List::~List() {