Operators are shown in decreasing order of precedence from top to bottom (Fig. A.1).
Operator |
Type |
Associativity |
---|---|---|
:: |
binary scope resolution |
left to right |
:: |
unary scope resolution |
|
() |
parentheses |
left to right |
[] |
array subscript |
|
. |
member selection via object |
|
-> |
member selection via pointer |
|
++ |
unary postfix increment |
|
-- |
unary postfix decrement |
|
typeid |
runtime type information |
|
dynamic_cast < type > |
runtime type-checked cast |
|
static_cast< type > |
compile-time type-checked cast |
|
reinterpret_cast< type > |
cast for nonstandard conversions |
|
const_cast< type > |
cast away const-ness |
|
++ |
unary prefix increment |
right to left |
-- |
unary prefix decrement |
|
+ |
unary plus |
|
- |
unary minus |
|
! |
unary logical negation |
|
~ |
unary bitwise complement |
|
sizeof |
determine size in bytes |
|
& |
address |
|
* |
dereference |
|
new |
dynamic memory allocation |
|
new[] |
dynamic array allocation |
|
delete |
dynamic memory deallocation |
|
delete[] |
dynamic array deallocation |
|
( type ) |
C-style unary cast |
right to left |
.* |
pointer to member via object |
left to right |
->* |
pointer to member via pointer |
|
* |
multiplication |
left to right |
/ |
division |
|
% |
modulus |
|
+ |
addition |
left to right |
- |
subtraction |
|
<< |
bitwise left shift |
left to right |
>> |
bitwise right shift |
|
< |
relational less than |
left to right |
<= |
relational less than or equal to |
|
> |
relational greater than |
|
>= |
relational greater than or equal to |
|
== |
relational is equal to |
left to right |
!= |
relational is not equal to |
|
& |
bitwise AND |
left to right |
^ |
bitwise exclusive OR |
left to right |
| |
bitwise inclusive OR |
left to right |
&& |
logical AND |
left to right |
|| |
logical OR |
left to right |
?: |
ternary conditional |
right to left |
= |
assignment |
right to left |
+= |
addition assignment |
|
-= |
subtraction assignment |
|
*= |
multiplication assignment |
|
/= |
division assignment |
|
%= |
modulus assignment |
|
&= |
bitwise AND assignment |
|
^= |
bitwise exclusive OR assignment |
|
|= |
bitwise inclusive OR assignment |
|
<<= |
bitwise left-shift assignment |
|
>>= |
bitwise right-shift assignment |
|
, |
comma |
left to right |
Introduction to Computers, the Internet and World Wide Web
Introduction to C++ Programming
Introduction to Classes and Objects
Control Statements: Part 1
Control Statements: Part 2
Functions and an Introduction to Recursion
Arrays and Vectors
Pointers and Pointer-Based Strings
Classes: A Deeper Look, Part 1
Classes: A Deeper Look, Part 2
Operator Overloading; String and Array Objects
Object-Oriented Programming: Inheritance
Object-Oriented Programming: Polymorphism
Templates
Stream Input/Output
Exception Handling
File Processing
Class string and String Stream Processing
Web Programming
Searching and Sorting
Data Structures
Bits, Characters, C-Strings and structs
Standard Template Library (STL)
Other Topics
Appendix A. Operator Precedence and Associativity Chart
Appendix B. ASCII Character Set
Appendix C. Fundamental Types
Appendix D. Number Systems
Appendix E. C Legacy Code Topics
Appendix F. Preprocessor
Appendix G. ATM Case Study Code
Appendix H. UML 2: Additional Diagram Types
Appendix I. C++ Internet and Web Resources
Appendix J. Introduction to XHTML
Appendix K. XHTML Special Characters
Appendix L. Using the Visual Studio .NET Debugger
Appendix M. Using the GNU C++ Debugger
Bibliography