As to when to not use inheritance. A stack while you may think of it as a specialization of a List (Vector in Java) it is a bad candidate for inheritance because it actually offers a much smaller set of functionality then a regular list. Therefore, if stack inherits from Vector everything that Vector offers (including removing an arbitrary elemen and deleting an arbitrary element) is now part of the public interface of your stack and can be called.

Inheritance is best used when you the descendent class is the parent plus. For example, a SortedCollection extends OrderedCollection in Smalltalk.