Templates provide a way to write generic routines and classes once.
For example, instead of having to write separate routines to swap two ints, swap two doubles, swap two floats, swap two chars, etc. In this example we implement stacks of any given data type. This won't work for strings, but you can specialize the function by overriding. The lower bound doesn't have to be 0. Arrays are copied by value, instead of copying a pointer.