Lecture 2 - Page 41 : 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#
The standard library namespace
All facilities in the C++ Standard Library are defined in the
std
namespace
Namespace resolution
Use the scope operator
::
on every name you use from the standard name space
std::cout << s1 << std::endl;
Allows for symmetric use of the same names from other namespaces
Tedious in short and simple programs
Apply using declarations on selected names from the standard namespace
using std::cout; using std::endl;
Tedious, just in another way...
Apply a single using directive
using namespace std;
All names from the standard namespace can be used without qualifiction
OK for namespace composition - OK in certain local scopes
Sloppy and lazy
if used in the global namespace
The C++ Programming Language
: Page 179: Namespace composition