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:
“The only rules comedy can tolerate are those of taste, and the only limitations those of libel.”
—James Thurber (18941961)
“The literal alternatives to [abortion] are suicide, motherhood, and, some would add, madness. Consequently, there is some confusion, discomfort, and cynicism greeting efforts to find or emphasize or identify alternatives to abortion.”
—Connie J. Downey (b. 1934)