Esempio n. 1
0
        public Object pop()
        {
            var topElement = StackComponent.top();

            StackComponent = StackComponent.pop();
            return(topElement);
        }
Esempio n. 2
0
 public Stack()
 {
     StackComponent = new EmptyStack();
 }
Esempio n. 3
0
 public void push(Object anObject)
 {
     StackComponent = StackComponent.push(anObject);
 }
 public NonEmptyStack(Object anObject, int previousNumberOfItems, StackComponent previousTop)
 {
     numberOfItems     = previousNumberOfItems + 1;
     previousTopObject = previousTop;
     topItem           = anObject;
 }