private class member access
I noticed this when I was doing some programming in my game.
That is the gist of the coord struct. Now, when I was coding the targeting system, I inadvertently used the cReside pointer to access a private data member of the Character class, but much to my surprise, the program compiled!
short int x;
short int y;
coord* cLP;//this is a linked list pointer
Character* cReside;//this points to a character object to indicate
//that a character is in this location
Now granted, the pointers of the coord struct are public, but the pItem array is still private in the Character class. Can somebody tell me why this access is possible?