Generally speaking, how would I set a pointer to another object in the same class? For example, say I was building a class called "Team." After I create objects (team members), I want to have a pointer data field which will allow me to point to another team member ("partner"). Setting a team member as a partner should also set up a pointer from that person to the original member I set the partner for. I.E. if I create a team member Harry and point to another team member Ron as his partner, Ron should "point" to Harry as his partner, too.
Am I on the right track? How would I construct these objects?
1 2 3 4 5 6 7 8
class Team
{
public:
bool practiced;
Team partner;
};
Thanks, you were a great help. I'm having trouble with the createPairing function, though. How should I call the function in the main function? It is giving me an error when I try to compile.