
21 Dec
2015
21 Dec
'15
4:40 a.m.
Hello all, I was trying to model things which can contain other things. This is easy as long as containers and the contained items all can be described in the same fashion. However when I want to model - say - trucks containing boxes containing parcels containing cans and trucks, boxes, parcels and cans are not of the same type, then this nested thing will become a type in its own right and it will be of a different type than trucks containing cans (which are not wrappen in parcels ...) As long as I can squeeze trucks, boxes ... into one type, possibly by using a "container_type" attribute, there is no problem. Is this the only way to do this? Is there an idiom?