Zaibon

Untitled

Nov 23rd, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #ifndef VECTEUR_H
  2. #define VECTEUR_H
  3.  
  4. using namespace std;
  5.  
  6. #include "Exceptions/InvalidIndiceExceptions.h"
  7. #include "Exceptions/VecteurFull.h"
  8. #include "Exceptions/VecteurEmpty.h"
  9.  
  10. template <class T> class Vecteur{
  11.  
  12.     protected:
  13.         T * tab;
  14.         int size;
  15.         int nb;
  16.         char *occup;
  17.    
  18.     public:
  19.         //constructeur
  20.         Vecteur();
  21.         Vecteur(const int size);
  22.         //desctructeur
  23.         ~Vecteur();
  24.         //getter - setter
  25.         void setSize(const int s){ size = s;}
  26.         const int getSize() const { return size; }
  27.         void setNb(const int n){ nb = n; }
  28.         const int getNb() const { return nb; }
  29.  
  30.         //surcharge
  31.         void operator+(const T newElem);
  32.  
  33.         //methode
  34.         const void affiche() const;
  35.         const bool full() const { return (getNb() >= getSize()); }
  36.         const bool empty() const {
  37.             if(getNb() == 0) return true;
  38.             return false;
  39.         }
  40.         const bool indiceValide(const int i)const { return (i < getSize() ); }
  41.         const bool estOccupe(const int i)const { return (occup[i] == 1); }
  42.         const T getElement(const int i) const;
  43.         void setElement(const int i,const T newElem);
  44.         T retireElement(const int i);
  45.  
  46.    
  47. };
  48.  
  49. #endif
Advertisement
Add Comment
Please, Sign In to add comment