#ifndef DYNAMICCONTAINER_H #define DYNAMICCONTAINER_H #include <vector> #include "BaseContainer.h" using namespace std; template <class T> class DynamicContainer : public BaseContainer<T> { public: DynamicContainer(); virtual ~DynamicContainer(); int getSize() const; T getValue(const int index) const; void setValue (const int index,T value) ; T operator [] (int index) const ; T &operator [] (int index) ; private: int _length; vector<T> _data; }; template <class T> DynamicContainer<T>::DynamicContainer() { } template <class T> DynamicContainer<T>::~DynamicContainer() { delete &_data; } template <class T> int DynamicContainer<T>::getSize() const{ return _data.size(); } template <class T> T DynamicContainer<T>::getValue (const int index) const{ return _data.at(index); } template <class T> void DynamicContainer<T>::setValue (const int index,T value) { _data.push_back(value); } template <class T> T DynamicContainer<T>::operator[](int index) const{ return _data[index]; } template <class T> T &DynamicContainer<T>::operator[](int index) { return _data[index]; } #endifDosyayı İndir