ArrayList Implementation C++