Beginning C++ Through Game Programming, Fourth Edition by Michael Dawson

Beginning C++ Through Game Programming, Fourth Edition by Michael Dawson

Author:Michael Dawson [Dawson, Michael]
Language: eng
Format: epub, azw3, mobi, pdf
Publisher: Cengage Learning PTR
Published: 2014-06-25T07:00:00+00:00


* * *

Sometimes programmers prefix a reference name with the letter “r” to remind them that they’re working with a reference. A programmer might include the following lines:

int playerScore = 1000; int& rScore = playerScore;

* * *

One way to understand references is to think of them as nicknames. For example, suppose you’ve got a friend named Eugene, and he (understandably) asks to be called by a nickname—Gibby (not much of an improvement, but it’s what Eugene wants). So when you’re at a party with your friend, you can call him over using either Eugene or Gibby. Your friend is only one person, but you can call him using either his name or a nickname. This is the same as how a variable and a reference to that variable work. You can get to a single value stored in a variable by using its variable name or the name of a reference to that variable. Finally, whatever you do, try not to name your variables Eugene—for their sakes.

Trap



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.