Lecture 2 - Page 22 : 42
Notes about C++
Basic facilities
Basic facilities
Fundamental types i C++
Booleans
Structs in C++
Declarations and definitions
The structure of a declaration
Declaring several names together
Declarations as statements - declarations in conditions
Constants
The general notation of objects in C++
Lvalues
C-style strings
C++ style strings
Strings - examples
References
Rules for references
References - Examples
Constant References
References versus Pointers
Parameter passing in C++
Value return
Type conversion - Grand Overview
Implicit type conversions
Explicit type conversion
Function Overloading
Function Overloading - more detailed rules
Function Overloading - Examples
Vectors in C++
Vectors - examples
The free store
Input and output in C++
Overloaded operators and IO
Standard streams
Stream State
Manipulators
More manipulators
Logical program organization
More namespaces
Physical program organization
Example of program organization
The standard library namespace
Point Exercise - C++ versus C#
Type conversion - Grand Overview
The purpose of this page is to give an overview of implicit and explicit type conversion in C++
The C++ Programming Language
: Page 130-131, 408, 819
Implicit conversions
Between built-in, fundamental (numeric) types - some details next page
Between user-defined types and built-in types
Via constructors and conversion operators
More details
in the next lecture
In between user defined types
Explicit conversions to type
T:
C-style type casts:
(T)expr
or
T(expr)
using early C++ notation
static_cast<T>(expr)
from a related type
reinterpret_cast<T>(expr)
from an unrelated type - "dangerous"
dynamic_cast<T*>(expr)
from a related polymorphic type (pointer or reference types only)
const_cast<T>(expr)
from a closely related type (add or remove
const
qualifier)
Item 2 of
More Effective C++
has some basic arguments in favor of 'the new C++ casts' in contrast to C-style casts.