Reputation: 23
Could someone help me out with this UML diagram?
Given this UML diagram, suppose that at runtime, we have created objects a1 and a2 from class A, b1 and b2 from class B, c1 and c2 from class C, d1 and d2 from class D, e1 and e2 from class E. Which one of these situations could happen at runtime?
a. e1 contains d1, and d1 contains e2, and e2 contains b2
b. a1 contains c1, and c1 contains d1
c. b1 contains d1, and d1 contains e2
d. c1 contains a1, and a1 contains b1
I haven't been able to solve this, as I tend to think that both b) and d) are possible.
Upvotes: 2
Views: 424
Reputation: 873
a) is the correct answer.
b) is false, as a1 can't contain anything
c) is false, because b1 can't contain anything
d) is false, a1 can't contain anything
Description: C and it's children (D,E) can contain any class of this hierarchy as it can contain children of A
Upvotes: 1