Jump to content

? servers

? players online

Sarah

Legend
  • Posts

    1443
  • Joined

About Sarah

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Sarah's Achievements

Single Status Update

See all updates by Sarah

  1. 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.

×
×
  • Create New...