Inheritance (object-oriented Programming) - Limitations and Alternatives

Limitations and Alternatives

Using inheritance extensively in designing a program imposes certain constraints.

For example, consider a class Person that contains a person's name, address, phone number, age, gender, and race. We can define a subclass of Person called Student that contains the person's grade point average and classes taken, and another subclass of Person called Employee that contains the person's job-title, employer, and salary.

In defining this inheritance hierarchy we have already defined certain restrictions, not all of which are desirable.

Read more about this topic:  Inheritance (object-oriented Programming)

Famous quotes containing the words limitations and/or alternatives:

    Much of what contrives to create critical moments in parenting stems from a fundamental misunderstanding as to what the child is capable of at any given age. If a parent misjudges a child’s limitations as well as his own abilities, the potential exists for unreasonable expectations, frustration, disappointment and an unrealistic belief that what the child really needs is to be punished.
    Lawrence Balter (20th century)

    Clearly, society has a tremendous stake in insisting on a woman’s natural fitness for the career of mother: the alternatives are all too expensive.
    Ann Oakley (b. 1944)