// Chap 6, p 268 // Reanme this file as StackL.cpp // ********************************************************* // Implementation file StackL.cpp for the ADT stack. // ADT list implementation. // ********************************************************* #include "c6StackL.h" // header file stackClass::stackClass() { } // end constructor stackClass::stackClass(const stackClass& S): L(S.L) { } // end copy constructor stackClass::~stackClass() { } // end destructor boolean stackClass::StackIsEmpty() { return boolean(L.ListLength() == 0); } // end StackIsEmpty void stackClass::Push(stackItemType NewItem, boolean& Success) { L.ListInsert(1, NewItem, Success); } // end Push void stackClass::Pop(boolean& Success) { L.ListDelete(1, Success); // Assertion: If list was empty at entry, Success is FALSE. } // end Pop void stackClass::GetStackTop(stackItemType& StackTop, boolean& Success) { L.ListRetrieve(1, StackTop, Success); // Assertion: If list was empty at entry, Success is FALSE. } // end GetStackTop // End of implementation file.