Added constructor and destructor for dynamic array