summaryrefslogtreecommitdiffstats
path: root/variablearray.h
blob: 8b793a3d799e413279c60899765cba2b16499f31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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