|
|
Class Inheritance
When creating an application, the uppermost levels of functional behavior are developed in the form of abstractions that contain a set of descriptions of the capabilities and characteristics that the objects in a given abstraction set, or class, will have. Any object that belongs to a given class "inherits" all the behaviors defined for that class, and possesses additional behavior that makes that object unique within that class.
Perhaps the best way to look at class inheritance is, again, through a parallel in nature, where the principle of acquired characteristics is everywhere. When we look at a living entity, say a frog, for example, all we see is the frog. A biologist, however, probably sees something like animal --> vertebrate --> amphibian --> frog --> Colombian Tree Frog. In this example, animal is the most abstract class to which the frog belongs -- the biologist would call it a kingdom -- and all the subclasses that follow inherit from it: all vertebrates are animals, all amphibians are vertebrates, all frogs are amphibians, and all Colombian Tree Frogs are frogs. By the same token, Colombian Tree Frogs have certain characteristics that no other frog species has -- a highly poisonous skin, for one. Likewise, frogs have anatomical and physiological features that no other amphibians possess, and amphibians are uniquely equipped to live both in water and in land, unlike any other vertebrates.
One thing to notice from the example is that the characteristics that distinguish each level in the Colombian Tree Frog's biological chain are additions to the characteristics inherited from previous levels. The significance here is this: if a Colombian Tree Frog stubs its toe, other Colombian Tree Frogs are left unaffected. Likewise, if a change in the environment causes a mutation in Colombian Tree Frogs, no other frog species will necessarily change. A change in one object does not affect any other objects in a class; a change in a class does not affect the classes from which it inherits.
|