Heterogeneous Associations – Data Modeling When an Object that Must Relate to One of Many Classes
Suppose you have 3 classes: ClassA
, ClassB
and ClassC
. Now suppose you have a class Message
. You want a one-to-many
relationship between each one of those three classes and the Message.
Heterogeneous Associations – Data Modeling When an Object that Must Relate to One of Many Classes
Suppose you have 3 classes: ClassA
, ClassB
and ClassC
. Now suppose you have a class Message
. You want a one-to-many
relationship between each one of those three classes and the Message.
Heterogeneous Associations – Data Modeling When an Object that Must Relate to One of Many Classes
Suppose you have 3 classes: ClassA
, ClassB
and ClassC
. Now suppose you have a class Message
. You want a one-to-many
relationship between each one of those three classes and the Message.
Why is it bad to have one mechanism for inheritance and subtyping?
It is quite well-known that (class) inheritance and subtyping (sometimes called interface inheritance) are different things: inheritance is a mechanism for sharing code, while subtyping is a relationship that allows an object of a subtype to be substituted where an object of a supertype is required, which is a kind of polymorphism.