A
Andy White
template <class Type>
class Array
{
public:
explicit Array(int size = DefaultArraySize);
Array(Type *array, int array_size);
Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
bool operator==(const Array &) const;
bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];}
virtual void sort();
virtual Type min() const;
virtual Type max() const;
virtual int find(const Type &value) const;
protected:
static const int DefaultArraySize = 12; // <----- problem, compiler says
illegal pure syntax, must be 0.
// Why wont my
compiler let this go?
//My book says
this is ok as long as it's "static const int".
int _size;
Type *ia;
};
class Array
{
public:
explicit Array(int size = DefaultArraySize);
Array(Type *array, int array_size);
Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
bool operator==(const Array &) const;
bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];}
virtual void sort();
virtual Type min() const;
virtual Type max() const;
virtual int find(const Type &value) const;
protected:
static const int DefaultArraySize = 12; // <----- problem, compiler says
illegal pure syntax, must be 0.
// Why wont my
compiler let this go?
//My book says
this is ok as long as it's "static const int".
int _size;
Type *ia;
};