Recreating a stack using C++ from scratch