Пример #1
0
        public Object pop()
        {
            var topElement = StackComponent.top();

            StackComponent = StackComponent.pop();
            return(topElement);
        }
Пример #2
0
 public Stack()
 {
     StackComponent = new EmptyStack();
 }
Пример #3
0
 public void push(Object anObject)
 {
     StackComponent = StackComponent.push(anObject);
 }
Пример #4
0
 public NonEmptyStack(Object anObject, int previousNumberOfItems, StackComponent previousTop)
 {
     numberOfItems     = previousNumberOfItems + 1;
     previousTopObject = previousTop;
     topItem           = anObject;
 }