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