//array.h
#ifndef ARRAY_H
#define ARRAY_H

template <class T>
class Array;

template <class T>
class Array_Itr	{
   Array<T> &array;
   int element;
public:
   Array_Itr(Array<T> &arry, int pos) : array(arry), element(pos) { }
   Array<T>& operator=(T val);
   operator T();
};

template <class T>
class Array	{
   const char* name;
   T *values;
   int size;
   friend class Array_Itr<T>;
public:
   Array(int sz,char* n="");
   Array_Itr<T> operator[](int idx);
};

struct ArrayError	{
   const char* name;
   const char* service;
   int index;
   enum Type { Memory, Range };
   Type type;
   ArrayError(const char* n, const char* s, Type eType, int idx=0)
	: name(n), service(s), type(eType), index(idx)	{ }
};

#include "array.cpp"
#endif


