Are subclasses considered collaborators of their superclasses?

242 views Asked by At

If you have, say, an abstract XMLParser class that you extend to make XMLParser1 and XMLParser2, is XMLParser a collaborator of XMLParser1 and XMLParser2?

1

There are 1 answers

0
Rob On

Actually a good question, but I would say no: why? because the whole idea of inheritance is that the class in question is getting some of its attributes and behaviors from its ancestor, so what you are actually asking is can a class collaborate with itself? In some kind of schizoid version of objects I guess you could say that makes sense, but no, I would for sure not depict the aspects of its behavior as distinct in a collaboration diagram.

Also, keep in mind that the whole point of collaboration diagrams is to depict who is doing what. If it truly is not the case that the subclass is an atomic entity, your model is probably wrong.