Gadget
predatorptrvector.h
Go to the documentation of this file.
1 #ifndef predatorptrvector_h
2 #define predatorptrvector_h
3 
4 class Predator;
5 
11 public:
15  PredatorPtrVector() { size = 0; v = 0; };
20  PredatorPtrVector(const PredatorPtrVector& initial);
30  void resize(Predator* value);
36  void Delete(int pos);
41  int Size() const { return size; };
47  Predator*& operator [] (int pos) { return v[pos]; };
53  Predator* const& operator [] (int pos) const { return v[pos]; };
54 protected:
62  int size;
63 };
64 
65 #endif
This class implements a dynamic vector of Predator values.
Definition: predatorptrvector.h:10
int size
This is the size of the vector.
Definition: predatorptrvector.h:62
PredatorPtrVector()
This is the default PredatorPtrVector constructor.
Definition: predatorptrvector.h:15
int Size() const
This will return the size of the vector.
Definition: predatorptrvector.h:41
void resize(Predator *value)
This will add one new entry to the vector.
Definition: predatorptrvector.cc:22
void Delete(int pos)
This will delete an entry from the vector.
Definition: predatorptrvector.cc:37
Predator ** v
This is the vector of Predator values.
Definition: predatorptrvector.h:53
~PredatorPtrVector()
This is the PredatorPtrVector destructor.
Definition: predatorptrvector.cc:15
Predator *& operator[](int pos)
This will return the value of an element of the vector.
Definition: predatorptrvector.h:47
This is the base class used to model the consumption by a predator.
Definition: predator.h:25