//Stack.h #ifndef STACK_H #define STACK_H const int DELTA = 5 ; // default growing size class Stack { // Interface public: Stack() { init( DELTA ); } Stack( int in_size ) { init(in_size); } Stack(const Stack& other) { // Use init to set all vars naturally init( other.bufsize ) ; if ( s == other.s ) { std::cout << "sAmE" << std::endl; } // Then update the count as this is dependant on the copied Stack count = other.count ; // Copy elements for ( int i=0 ; i < bufsize ; i++ ) { s[i] = other.s[i] ; } } ~Stack() { delete[] s; } int nitems() { return count ; } bool full() { return (count==bufsize) ; } bool empty() { return (count==0) ; } void push( double c ); double pop(); void inspect(); void grow( int delta ); // Implementation private: void init( int in_size ); double* s ; int count ; int bufsize ; }; #endif