Introduction to C++: Glossary

Key Points

Structure of a Program
  • C++ formatting is very flexible, whitespace generally doesn’t matter.

  • C++ has two styles of comments, for single lines, and for multi-lines.

  • Libraries generally exist in a separate namespace.

Variables and Types
  • The type of each variable must be declared.

  • The fundamental data types available in C++ closely match the native system types.

  • Variables can be initialized at the time they are declared.

Constants
  • Literals are available for all the fundamental data types.

  • Constant expressions can be defined using the const keyword.

Operators
  • C++ provides an extensive set of arithmetic and logical operators.

Basic Input/Output
Control of Flow
  • Decisions are made using if and select statements.

  • Looping is performed with while, do-while, and for statements.

Functions
  • Functions are the primary way to structure programs and achieve code reuse.

  • Execution can be transferred to a function, then resume at the point the function was invoked.

  • Functions can be supplied multiple values, but only return a single value.

Function Overloading
Templates
Name Visibility
  • Different scopes provide a means of controlling the visibility and life of variables.

  • Namespaces provide additional flexibility for name visibility.

  • How data is stored is related to its scope.

Arrays
  • Arrays provide a convenient way of storing many values of the same type.

  • Arrays are defined by a name and elements are accessed using an index.

  • C++ supports multi-dimensional arrays.

  • Arrays can only be passed by reference as parameters to functions.

Character Sequences
Pointers
Structs
  • Struct types are for grouping different data types together.

  • Accessing members of a struct is just like accessing a variable.

  • Arrays of structs are allowed.

  • Structs can contain any data type, including other structs.

Classes I
  • Classes encapsulate both data and functions.

  • Classes are types, objects are variables.

  • Classes allow access to members to be controlled.

  • A constructor can be used to initialize data members.

Exceptions
  • Exceptional conditions occur within any program.

  • Handling exceptions is important to ensuring program correctness.

  • Exception handlers are just like regular functions.

  • Operations in the standard library throw exceptions.

Command Line Arguments
  • Special parameters in the main function are used to handle command-line parameters.

  • Each parameter is a string, and special processing must be performed by the program

Glossary

FIXME