Generics > Generic Classes: Section III
class Stack<T> { int index = 0; T[] innerArray = new T[100]; public void Push(T item) { innerArray[index++] = item; } public void T Pop() { return innerArray[--index]; } public T Get(int k) { return innerArray[k]; } } Stack<int> intStack = new Stack<int>(); intStack.Push(3); intStack.Push(6); intStack.Push(7); Console.WriteLine(intStack.Get(1)); //Outputs 6 So, basically every time you "Push()" the code adds to a position/index to the array (or list)? So, if I push two (2) more items into the list, and then want to retrieve that item, "Console.WriteLine(intStack.Get(4))" would work? As you start counting on zero (0). What does the Pop() do? How would you remove an item or overwrite it?