#pragma once template class SHStack { public: SHStack(long depth = -1); virtual ~SHStack(); virtual bool Pop(T&t) = 0; virtual bool Push(T const&t) = 0; virtual void GoBack() = 0; virtual void GoAhead() = 0; virtual void Clear() = 0; virtual long GetDepth() = 0; virtual bool GetTopData(T&t) = 0; virtual T& operator[](long i) = 0; void SetMaxDepth(long depth); long GetMaxDepth(); bool IsDepthLimited(); bool IsEmpty(); bool CanGoBack(); bool CanGoAhead(); protected: long maxDepth; long oldDepth; }; template SHStack::SHStack(long depth) { maxDepth = depth; oldDepth = 0; } template SHStack::~SHStack() { } template void SHStack::SetMaxDepth(long depth) { maxDepth = depth; } template long SHStack::GetMaxDepth() { return maxDepth; } template bool SHStack::IsDepthLimited() { return maxDepth >= 0; } template bool SHStack::IsEmpty() { return GetDepth() == 0; } template bool SHStack::CanGoBack() { return !IsEmpty(); } template bool SHStack::CanGoAhead() { return oldDepth > GetDepth(); }