Lecture 2 - Page 34 : 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#
Stream State
The C++ Programming Language
: Page 616
Streams in C++ have state associated that represents
error conditions
and
formatting details
Error condition or non-standard condition - class
basis_ios
strm.good()
strm.eof()
strm.fail()
strm.bad()
In boolean contexts, a stream is converted to a value of type
void*
Using an
implicit conversion operator
in class
basis_ios
The value is zero (false) if the stream is in failing state
Formatting flags - class
ios_base
For white space skipping, ajustment, padding, integer base, floating point formatting, etc.
The formatting flags can be read and written together (p. 626)
Illustration of implicit stream conversion to a boolean value.
At a higher level of abstraction, the formatting flags are changed by so-called
manipulators
- see next page