Logic Fault

Have you considered running your software on a computer?


On Subclassing

Class hierarchy is inferior to if/else as a way of modelling conditional behaviour. This statement probably doesn’t mean what you want it to mean, though.

Prefer shorter hierarchies with functionality-containing abstract classes over interfaces.

It is better to add a small amount of functionality to the “wrong” class in a hierarchy (i.e. adding specific functionality to an abstract base class, or adding functionality that conditionally detects situations that only arise in sibling classes to a leaf class) than it is to add an entire new layer to the hierarchy. This is only occasionally a mutually exclusive choice.