A basic criterion for a proper relationship between a class and a derived class.

A fundamental goal of Object-Oriented programming is facilitating code reuse by creating general-purpose classes, then deriving from these more special-purpose classes which are "like" another class "except for" additional characteristics or functionality.

Therefore, having a "cat" class which derives from an "animal" class passes the test; a cat "is-a" animal, and inheritance is useful here.

Creating an "engine" class which derives from the "animal" class would be conceptually and practically useless; the entities are so different that all attributes of the derived class would have to be implemented distinctly. This inheritance fails the "is-a" test.

Log in or register to write something here or to contact authors.