Lecture 3 - Page 25 : 36
Notes about C++
Abstraction Mechanisms, Part 1
From C# classes to C++ classes
Organization of classes and members
Classes, structs and namespaces
Functions outside classes
Constructors
Constructors - initialization versus assignment
More about constructors
Use of constructors
Destructors
A class that needs a destructor
Resource acquisition is initialization - RAII
Auto Pointers
Object copying
Copying Point objects in parameter passing
Example of copying objects: Default copying
Example of copying objects: Programmed copying
Preventing object copying
Classes and Conversion
Implicit Conversion
Classes and Conversion: Examples
Static class members
Const member functions
Const member functions - const and mutable
Object Self-reference
Inline member functions
Concrete classes
Visibility and Access Control
Friends
Friends - Example 1
Friends - Example 2
Friends - class Point - notational convenience
Friends - Class Point - operator friends
Friends - Class Point - implicit conversion
Discussion - Encapsulation, Visibility and Access
Operator overloading
Example: Operator overloading in class Point
Inline member functions
In C++ the programmer can ask for inlining of functions
The C++ Programming Language
: Page 235, 144, 199
Inline functions
An efficiency concern
A plea to the compiler - not a requirement
Inline functions must be
defined
in every translation unit where they are used
Inline functions can be defined in header files
Some functions cannot easily be inlined
Recursive functions
Member functions defined inside class definitions are implicitly marked as inlined