Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _VETTORE_REGALI_H
- #define _VETTORE_REGALI_H
- #include <iostream>
- #include "Pacchetto.h"
- #include "ClasseEccezioneOutOfRange.h"
- using namespace std;
- typedef PacchettoRegalo A;
- class ListaPacchetti {
- friend ostream & operator<<(ostream&, const ListaPacchetti &);
- friend istream & operator>>(istream&, ListaPacchetti &);
- private:
- static int count; //anche se non esplicitamente richiesta nella traccia, uso un contatore per il vettore dinamico
- A * V;
- int Nelem;
- public:
- explicit ListaPacchetti(const int = 10); //per impedire la conversione implicita del riempimento del vettore
- ListaPacchetti (const int, const A &);
- ListaPacchetti (const ListaPacchetti &);
- int get_Nelem() const {return Nelem;}
- static int get_count() {return count;}
- A & operator[](int);
- const A & operator[](int) const; //Necessaria poiché si fa riferimento a un vettore costante
- class EccezioneOutOfRange {};
- static A & Access(int index) throw(EccezioneOutOfRange);
- ~ListaPacchetti() {count--; delete [] V;}
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment