Generalization SemanticsFlavors of Inheritance
Specification inheritance
- yields type hierarchies
- preconditions must not become stricter, postconditions not weaker
- DQueue subtype-of Stack
- contravariance
- Stack::push: Stack x Element ? Stack
- DQueue::push: Stack x Element ? Stack (possibly: DQueue)
Specialization inheritance
- yields is-a hierarchies
- Integer is-a Rational
- covariance
- Rational::*: Rational x Rational ? Rational
- Integer::*: Integer x Integer ? Integer
Implementation inheritance
- no conceptual relationship at all
not distinguished in UML!