Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef VECTEUR_H
- #define VECTEUR_H
- using namespace std;
- #include "Exceptions/InvalidIndiceExceptions.h"
- #include "Exceptions/VecteurFull.h"
- #include "Exceptions/VecteurEmpty.h"
- template <class T> class Vecteur{
- protected:
- T * tab;
- int size;
- int nb;
- char *occup;
- public:
- //constructeur
- Vecteur();
- Vecteur(const int size);
- //desctructeur
- ~Vecteur();
- //getter - setter
- void setSize(const int s){ size = s;}
- const int getSize() const { return size; }
- void setNb(const int n){ nb = n; }
- const int getNb() const { return nb; }
- //surcharge
- void operator+(const T newElem);
- //methode
- const void affiche() const;
- const bool full() const { return (getNb() >= getSize()); }
- const bool empty() const {
- if(getNb() == 0) return true;
- return false;
- }
- const bool indiceValide(const int i)const { return (i < getSize() ); }
- const bool estOccupe(const int i)const { return (occup[i] == 1); }
- const T getElement(const int i) const;
- void setElement(const int i,const T newElem);
- T retireElement(const int i);
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment