A common, deep mistake in polymorphism

  • I'd rather see Vector<Fruit> than Vector<AppleOrOrange> or Vector<TreeBearingFruit>

    The point is first to change the code s.t. you're dealing with a superclass vs the subclasses. The name of the classes is not spectacularly important, it's just important that it is understandable. Fruit with a comment about the nature of said fruit is imho more readable than some obscure but specific class name.