Mi da (riga in neretto):codice:#include <iostream> #include <cstdio> #include <string> #include <vector> using namespace std; template<class T> class Stack { public: // Constructor with dimension Stack(int dim) { vet = new T[checkDim(dim)]; }; // Constructor without dimension Stack() { vet = new T[5]; }; // Check and verify the chosed dimensione int checkDim(int dim) { return(dim <= 0)?5:dim; }; // The destructor ~Stack(){}; // add a element void push(T value) { vet[sp++] = value; }; // return a element (and no delete) T pop() { return vet[sp--]; }; // return a element (and delete) T pop_d() { int index =sp--; T tmp = vet[index]; delete vet[index]; return tmp; }; private: T vet; int sp; };
P:/C++/stack/stack.h:21: invalid types `int[int]' for array subscript
Tnk 100000000000