// LONG.H - dynamically allocated array class #ifndef LONG_H #define LONG_H #include class LongArray { public: LongArray( unsigned sz = 0, long defval = 0 ); // Construct an array of size sz, initialize all // elements with defval. LongArray( const LongArray & L ); // Copy constructor. ~LongArray(); // Destructor. unsigned GetSize() const; // Return the current allocation size. void GrowBy( unsigned n ); // Increase the allocation size by n elements. void Init( long defval = 0 ); // Initialize all elements to defval. long Get( unsigned i ) const; // Retrieve element at index position i. void Put( unsigned i, long elt ); // Insert element at index position i. private: long * data; // ptr to array containing elements unsigned size; // current allocation size long initv; // initial value }; #endif