Lecture 2 - Page 23 : 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#
Implicit type conversions
"
Integral og floating-point types can be mixed freely in assignments and expressions
"
The C++ Programming Language
: Page 833
"
Fundamental types can be converted to each other in a bewildering number of ways
"
Promotions
A kind of
normalization
to certain integer types and floating point types before arithmetic operations
Usual Arithmetic conversions
Convert arguments of binary operators to a common type
Conversion to boolean
From pointers, integers, and floating point types
Non-zero value transformed to
true
and zero to
false
Conversion between integer types
Unsigned: Cutting off bits
Signed: Implementation dependent
Conversion between floating point and integer types
May cause loss of information, or may be undefined (in case of range problems)