Table of Contents


C++ doesn’t try to be everything for everybody, but it is rather good at the tasks for which it was designed – mostly systems programming, software infrastructure, and resource-constrained applications. (…) Basically, C++ was not primarily designed for tasks of medium complexity, medium performance, and medium reliability, written by programmers of medium skills and experience. – Bjarne Stroustrup

Sources of information


  1. Create header (.h) and source files (.cpp)
  2. Pre-processor creates pre-compiled source files
  3. Compiler creates object files (*.obj)
  4. Linker links object files and libraries (.lib) and creates executables (.exe)



Object orientation


A construtor is a method with the same name as its class. They contain the necessary commands to initialize an object.

  • Standard constructor

    This constructor is given implicitly without its explict implementation.

  • Converting constructor
  • Copy construtors
    • Shallow and deep copies

      A shallow copy compies only the pointers are of object variables. A shallow copy is created by the standard copy constructor and by a simple assignment.

      A deep copy creates a copy of the values of all member variables. In order to enable a deep copy a class needs to implement a constructor, destructor, copy constructor and an overloaded assignment operator. (fredosaurus.com)

  • Destructors

    This is a special method which is being invoked for the cleanup of an object before its death.


  • Visibility
    • Private
    • Public
    • Protected
    • Friends
      • methods
      • classes
  • Casting

    Implicit upcast:

    CVehicle* pVehicle = new CCar();

    Explicit downcast:

    CCar* pCar = static_cast<CCar*>(pVehicle);
  • Overloading
    • Methods
    • Operators
  • Multiple inheritance

Abstract classes

Abstract classes implement one or more pure virtual functions. Their task is to specify an interface. They cannot be instanciated.

Virtual functions

Local classes

A local class is defined within a function and is only visible there.

Static functions and variables

  • How to define a class constant?
    static const int DEFAULT_VALUE = 5;


Header and prototypes



  • Function template

    Used for the definition of functions which can be used with specific parameter types.

  • Class template

    Used for the definition of typ specific classes.

  • Container: a collection of objects
    • Iterators

      (c-plusplus.net | German only)

      • Categories
        • output iterator
        • input iterator
        • forward iterator
        • bidirectional iterator
        • random access iterator
    • More
      • Deque
      • List
      • Stack
      • Queue
      • Map
      • Multi map
      • Multi set
      • Pair
      • Set
      • Bitset