Circular dependency with the relationships “contains” and “is in”
问题 I would like to gather opinion from you about the following problem. We have a class called "Room". Each room may contain zero or more instances of a class "Person", so the Room stores a collection of Persons (e.g. vector). It owns them. However, there is some time-consuming logic related to moving Persons between Rooms, so the Person also contains current Room they are in. It is just a pointer without ownership . This information is theoretically redundant, because one could derive it from