A C++ program contains statements that alter the state of the storage managed by the program and determine the flow of program execution. There are several types of C++ statements, most of which are inherited from the C language. First, there is the simple statement, terminated with a semicolon, such as
x = y + z;
Next, there is the compound statement, or block, consisting of a sequence of statements enclosed in curly braces.
{ int temp = x; x = y; y = temp; }
The above example is a single compound statement that contains three simple statements. The variable temp is local to the block and is destroyed when the end of the block is reached.
In general, a compound statement can be placed wherever a simple statement can go. The reverse is not always true, however. In particular, the function definition
double area(double length, double width) { return length * width; }
cannot be replaced by
double area(double length, double width) return length * width;
The body of a function definition must always include a block.
Part I: Introduction to C++ and Qt 4
C++ Introduction
Classes
Introduction to Qt
Lists
Functions
Inheritance and Polymorphism
Part II: Higher-Level Programming
Libraries
Introduction to Design Patterns
QObject
Generics and Containers
Qt GUI Widgets
Concurrency
Validation and Regular Expressions
Parsing XML
Meta Objects, Properties, and Reflective Programming
More Design Patterns
Models and Views
Qt SQL Classes
Part III: C++ Language Reference
Types and Expressions
Scope and Storage Class
Statements and Control Structures
Memory Access
Chapter Summary
Inheritance in Detail
Miscellaneous Topics
Part IV: Programming Assignments
MP3 Jukebox Assignments
Part V: Appendices
MP3 Jukebox Assignments
Bibliography
MP3 Jukebox Assignments