Lecture 3 - Page 3 : 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
Classes, structs and namespaces
Structs and classes are similar in C++
A class/struct is a namespace "with some extra properties":
The C++ Programming Language
: Page 234,849
Class
Defines a named type where members are private by default
Typically used for user-defined types
A namespace "with some extra properties":
Struct
Defines a named type where members are public by default
Typically used for aggregation of public data
A namespace "with some extra properties":
Namespace
A scope
Named or unnamed
Global
Namespaces - logical program organization
Struct Point in C++ .
A namespace with struct Point in C++ .
Same with illustration of ambiguities relative to the global namespace.