"I'm my own grandpa" family tree: Let's say you want to create a C++ data structure for a family tree including spouses. You might use a class something like this: class Person { public: char *name; // name, birthdate, etc. char *birthdate; // ...etc... Person *spouse; // pointers to spouse, father, and mother Person *father; Person *mother; }; If we use horizontal lines to indicate the spouse relationship, and upward lines pointing to parents, then the "I'm my own grandpa" scenario would be something like this: \ ---------- \ / | Sam -----------> Sally | ^ <---------- | \ | \ | \ | \ | \ | \ / | \ / | Joe ----------> Jane | <--------- ^ | \ | \ | \--| where the upward lines which don't go anywhere point to people who are dead or irrelevant. Say Joe is the main character in the song. He's married to the widow Jane. Sally is Jane's daughter, married to Joe's widower father Sam. Assuming that `Person *' variables Sam, Sally, Joe, and Jane have been allocated, the relationships above would be coded as follows: Sam->spouse = Sally; Sam->father = Sam->mother = nullptr; Sally->spouse = Sam; Sally->father = nullptr; Sally->mother = Jane; Joe->spouse = Jane; Joe->father = Sam; Joe->mother = nullptr; Jane->spouse = Joe; Jane->father = Jane->mother = nullptr; In the song, words are twisted somehow to make it seem that the fact that Joe's wife's daughter's husband's son is Joe himself implies that Joe is his own grandpa. Continuing, Joe and Jane create a son named Bill, and Sam and Sally create a son named Bob: \ ---------- \ / | Sam -----------> Sally | ^ ^ <---------- ^ | \ \ / | \ \ /------/ | \ \ / | \ Bob | \ | \ / | \ / | Joe ----------> Jane | ^ <--------- ^ ^ | \ / \ | \ /---/ \ | \ / \--| \ / Bill Now Bob's mother's mother, i.e. his grandmother Jane, is married to his half-brother Joe, so his grandmother is also his sister-in-law. And Bill's grandfather is Sam, who is married to Bill's mother's daughter Sally, so Bill's grandmother is also his half-sister.