Thursday, October 29, 2015

INHERITNCE

Inheritance is a fundamental principle of object-oriented programming. It allows a class to "inherit" (behavior or characteristics) of another, more general class. For example, a lion belongs to the biological family of cats (Felidae). All cats that have four paws, are predators and hunt their prey. This functionality can be coded once in the Felidae class and all its predators can reuse it – TigerPumaBobcat, etc. Inheritance is described as is-kind-of relationship, e.g. Tiger is kind ofAnimal.



No comments:

Post a Comment