Friday, 9 August 2013

Can "is-a" and "has-a" existed at the same time?

Can "is-a" and "has-a" existed at the same time?

Assume there are two class, Class B is subclass Class A and B has a
property a which is kind of A, as pseudo code below show:
class A {}
class B extends A {
A a;
}
In UML word, there are two relationships between class B and class A. B
'is-a' kind of A on while B 'has-a' property A. Can I represented these
relationships at the same time in one class diagram?

When I google this, it is common that only one relationship existed
between two class in all results. So I am not sure whether it is allowed
to draw diagram like this. If not how UML to express this kind of
relationships between class.

No comments:

Post a Comment