Gadget
preyptrvector.h
Go to the documentation of this file.
1 #ifndef preyptrvector_h
2 #define preyptrvector_h
3 
4 class Prey;
5 
11 public:
15  PreyPtrVector() { size = 0; v = 0; };
20  PreyPtrVector(const PreyPtrVector& initial);
30  void resizeBlank(int addsize);
35  void resize(Prey* value);
41  void Delete(int pos);
46  int Size() const { return size; };
52  Prey*& operator [] (int pos) { return v[pos]; };
58  Prey* const& operator [] (int pos) const { return v[pos]; };
59 protected:
63  Prey** v;
67  int size;
68 };
69 
70 #endif
This class implements a dynamic vector of Prey values.
Definition: preyptrvector.h:10
void Delete(int pos)
This will delete an entry from the vector.
Definition: preyptrvector.cc:54
PreyPtrVector()
This is the default PreyPtrVector constructor.
Definition: preyptrvector.h:15
Prey *& operator[](int pos)
This will return the value of an element of the vector.
Definition: preyptrvector.h:52
~PreyPtrVector()
This is the PreyPtrVector destructor.
Definition: preyptrvector.cc:15
void resize(Prey *value)
This will add one new entry to the vector.
Definition: preyptrvector.cc:22
int Size() const
This will return the size of the vector.
Definition: preyptrvector.h:46
Prey ** v
This is the vector of Prey values.
Definition: preyptrvector.h:58
int size
This is the size of the vector.
Definition: preyptrvector.h:67
void resizeBlank(int addsize)
This will add new blank (ie. NULL) entries to the vector.
Definition: preyptrvector.cc:37
This is the base class used to model the consumption of a prey.
Definition: prey.h:27