You are right, inheritance is perfectly applicable to the example from the article, basically because the example is very simple.
The idea is that in more complex scenarios the best practice is to prefer composition over inheritance because modelling every single piece of state with subclasses would be sloppy and unmaintainable.
That is where design-by-contract (or simply put guard clauses) usually come into play.