Home Segments Index Top Previous Next

292: Mainline

The subclass–superclass versus part–whole issue is mercurial, in part, because different applications may view the same objects from different perspectives. For applications that deal with railroads, a box car is best viewed as a railroad car that has a box; for applications that deal with containers, a box car is best viewed as a box that has wheels that run on tracks. Thus, there is no universal right answer to the decision between modeling with the subclass–superclass relation and with the part–whole relation.