rune
rune copied to clipboard
Doubly linked relation?
In the class example in the README, the Human class adds self to mother and father. However it does not add mother and father anywhere into self, which is what I would expect with "DoublyLinked." What does it mean?
mother.appendMotheredHuman(self) adds self to the doubly-linked list of mothered children of mother. This also sets a back pointer from self to mother. That way, we later are destroyed, our destructor can use that back pointer to find our mother and remove us from her list of mothered children. We can access our mother with self.motherHuman, and our father with self.fatheredHuman
Does that make sense? I'm not used to describing doubly-linked lists and back-pointers. I've been using them for decades.