Last night we read two chapters on inheritance from Sandi Metz’s book, Practical Object-Oriented Design in Ruby. The concept of inheritance is fairly simple on the surface. You create a bare-bones super-class that only includes things that sub-classes, or different types of that class, will have in common. You link your sub-classes to your super-class so that they get all characteristics of the super-class, and they can add their own unique aspects on top of those.
I think the concept of inheritance makes sense, but reading Metz’s chapters on it gave me a sense of all the many possible pitfalls you can run into when using them. After I start using inheritance in practice, I want to re-read those chapters so that I can have more context and immediately apply the concepts she covers.
The pokemon game we’re building for class will be a great opportunity to practice inheritance. Pokemon, in general, will have certain characteristics. For example, they will each have a name and a type. Then each species of Pokemon will be a sub-class with its own special modifications such as attacks, behaviors, etc. Some Pokemon species, such as Eevee, may have additional sub-classes as they evolve, since some aspects of the pokemon may change but the base form will stay the same.