diff options
Diffstat (limited to 'variablearray.h')
-rw-r--r-- | variablearray.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/variablearray.h b/variablearray.h new file mode 100644 index 0000000..8b793a3 --- /dev/null +++ b/variablearray.h @@ -0,0 +1,37 @@ +#ifndef _VARIABLEARRAY_H_ +#define _VARIABLEARRAY_H_ + +#include "collection.h" +#include <string> +#include <sstream> +#include <vector> + +#define ARR_STARTING_SIZE 8 + +class VariableArray : public Collection +{ + public: + VariableArray(); + VariableArray(const VariableArray&); + VariableArray& operator=(const Collection&); + ~VariableArray(); + + virtual void add(int); + virtual bool remove(int); + virtual int operator[](const int); + virtual VariableArray *copy(void); + + /* override these methods that had empty definitions in the interface */ + void iterate(void (*)(int *)); + bool contains(int) const; + + std::string print(void) const; + + protected: + + private: + std::vector<int> arr; +}; + +#endif + |