using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

namespace HelloXaml.Models
{
    class Stack<T> where T : class
    {
        private readonly int size;

        public int Size { get; private set; }

        private int current = 0;
        private T[] items;

        public Stack(int size) {
            this.size = size;
            items = new T[size];
        }

        public void Push(T item)
        {
            if (current >= size) {
                return;
            }

            items[current] = item;
            current++;
        }

        public T Pop() {
            if (current <=0) {
                return null;
            }
            return items[current--];
        }
    }
}
