Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubly linked relation? #8

Open
jgarvin opened this issue Nov 27, 2022 · 1 comment
Open

Doubly linked relation? #8

jgarvin opened this issue Nov 27, 2022 · 1 comment

Comments

@jgarvin
Copy link

jgarvin commented Nov 27, 2022

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?

@waywardgeek
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants