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:
“No man could bring himself to reveal his true character, and, above all, his true limitations as a citizen and a Christian, his true meannesses, his true imbecilities, to his friends, or even to his wife. Honest autobiography is therefore a contradiction in terms: the moment a man considers himself, even in petto, he tries to gild and fresco himself.”
—H.L. (Henry Lewis)
“The last alternatives they face
Of face, without the life to save,
Being from all salvation weaned
A stag charged both at heel and head:
Who would come back is turned a fiend
Instructed by the fiery dead.”
—Allen Tate (18991979)