Terminology and Symbols
◀ What This Book Covers▶ Naming Conventions Amazon
irst I want you to be familiar with the terminology and symbols I will be using throughout the book. There could exist more than one term that refer to the same thing, and I do my best in using the most common and accepted terms.
The following table lists terms, their meanings, and examples. In the example column, sometimes I use ~ to replace the corresponding term for brevity.
|char||A variable of type char||The function returns a char.|
|character array||The traditional C string, which is type char||This function returns a character array.|
|char array||Same as above||This function returns a char array.|
|bool||A variable of type bool||The function returns a bool.|
|bool array||An array of type bool||The function returns a bool array.|
|int||A variable of type int||The first argument to getGPA() is an int.|
|int array||An array of type int||The function returns an int array.|
|double||A variable of type double||The function returns a double.|
|double array||An array of type double||The function returns a double array.|
|string||An instance of C++ string class||The function returns a string.|
|the invoking object||The object that invokes the function|
Student mike;mike.getID();mike is ~.
|struct||A user-defined structure||The name of the struct is foo.|
|object||An instance of a class||Jennifer is an object of class Students.|
The following table lists symbols, their meanings, and examples.
|()||A function||Lets write a function swap() that swaps two elements in an array.|
|‘’||A character||You need to append a # to the end of the string.|
|“”||A string or a word||inner#beauty#counts# is a valid input. The word template means…|
|<>||A library header||You need in this program.|
The following table lists words in different fonts, each of which has a special meaning.
./computer_sum 20 100The sum of 20 and 100 is 120.
|I use this font to indicate program outputs, user inputs, and actual program code.|
|data.txtdouble my_weightget_score()class Students||I put in bold type file names, data types, variable names, instance names, function names, class names, and any other program elements.|
|Naming convention is critical!||I use italic type to indicate emphasis, a special term, and chapter jokes.|
|Chapter 14Code SizeFigure 15.1||I underline a chapter name, a section name, and a figure.|
Very often I use the term “object” to mean “object reference”. In the following declarations:
is a class, I refer to circle
as objects of Paint
to avoid wordiness. Technically, they are known as object references or instances. Just keep it in mind.
Also, when I explain something, I usually struggle over the way I call the subject person. If I call the person “he”, girls may feel a little discriminated against, but if I call the person “she”, guys won’t be happy. Anyway, I got to choose one, and I choose “he” because it is shorter. Please excuse me for any inconvenience this may cause.
In fact, if you are a girl and are really bothered by it, let me know and if enough people have brought up this request, I promise I will revamp this book and publish the updated version as soon as possible. You have my word.
◀ What This Book Covers▶ Naming Conventions