-
Posts
3391 -
Joined
-
Last visited
-
Days Won
1
Content Type
Partners
Guides
Events
Forums
Profiles
Everything posted by TheVirus
-
The . operator is used when accessing a structure or class that is not a pointer. For example:
CPlayer cNewPlayer;
//some stuff
int iPID = cNewPlayer.getPlayerID();
printf("Player ID: %d\n", iPID);
The . operator calls the member function getPlayerID. Since the declaration wasn't a pointer, it doesn't use the -> operator. An example of using the -> would be:
CPlayerAmmo *cptrPAmmo;
//Some stuff
if ( cptrPAmmo->getHandgunAmmo() <= 0) {
cNewPlayer.setEmptyClip(mHandGun, true);
return 0;
}
Hope that helps.
Forum: Off Topic
Forum: Off Topic
Forum: Off Topic
Forum: Off Topic
Forum: Off Topic
Forum: Announcements
Forum: Completed
Forum: Completed
Forum: Announcements
Forum: Announcements
Forum: Off Topic