This course is a comprehensive hands-on introduction to object-oriented programming in C++ for C programmers. Emphasis is placed on the features of C++ that support effective modeling of the problem domain and reuse of code.
The course consists of two modules. In the first module, object-oriented concepts are introduced in addition a step-by-step instruction regarding the C++ class construct. Participants wills also study function and operator overloading, the use of references, the scope and access control mechanisms and inheritance.
The second module presents intermediate topics. The ANSI C++ Standard Library is covered, including namespaces, the new header files and basic string class. Templates are explored, as well as I/O streams and practical issues of C ++ programming, such as reliability, testing, efficiency and interfacing.
This course introduces newer features of C++ such as exceptions, runtime type information (RTTI and the new C++ cast syntax. It is designed so it may be taught in any environment with an ANSI C++ compiler and extensive programming examples and exercises are provided.
Participants are recommended to have a good working knowledge of C programming before attending this class.
- Concepts of Object-Oriented Programming
- Object
- State and Behavior
- Abstraction
- Encapsulation
- Class and Instantiation
- Abstract Data Types
- Methods
- Invoking Methods
- Messages
- Class Inheritance
- Polymorphism
- Classes in C++
- Data Encapsulation in C
- The C++ Class
- Structures and Class in C++
- Implementation of a C++ Class
- This Pointer
- Code Organization
- Scope Resolution Operator
- Abstract Data Types
- Test Programs for C++ Classes
- Functions in C++
- Function Prototypes in C++
- Strong Type Checking
- Conversion of Parameters
- Inline Functions
- Inline Functions in Header Files
- Default Arguments
- Function Overloading
- Argument Matching
- Argument Matching through Promotion
- Match through Type Conversion
- Call by Value
- Constructors and Destructors
- The Problem of Initialization
- Constructors and Initialization
- Constructor in Stack Class
- Object Creation and Destruction
- Destructors
- Multiple Constructors
- String Class Implementation
- Hidden Constructors
- C++ Programming for C Programmers
- Using a Default Argument
- Memory Management in C++
- Why is Memory Management Important in C++?
- Choices for an Object’s Memory
- Typical Memory Layout
- Free Store Allocation
- New Operator
- Memory Allocation Errors
- New vs. Malloc
- Delete Operator
- Destructor (Review)
- Hiding Memory Management
- String Class Specification (Version 2)
- String Class Implementation
- String Class Bug
- References and Argument Passing in
- C++
- Variables
- Argument Passing
- Call-by-Value
- Reference Declarations
- Call-by-Reference
- Copy Constructor
- Default Copy Constructor
- Bug in String Class
- Specification of String Class
- Implementation of String Class
- Test Program
- Output of Test Program
- Review of Constant Types
- Constants and Arguments
- Chains of Functions Calls
- Const Objects and Member Functions
- Operator Overloading, Initialization and Assignment Operator Overloading
- Operator Functions
- Semantics of return
- Returning a Temporary Object
- Returning a Reference oInitialization vs. Assignment
- Semantics of Assignment oAssignment
- Assignment Bug
- Overloading =
- Review of this Pointer
- Type Conversions
- Conversion by Construction
- Overloading Cast Operator
- Test Program
- Scope and Access Control
- Scoping in C++
- Block and Function Scope
- File and Global Scope
- Class Scope
- Constant Types and Scope
- Enumeration Types
- Enumeration Types and Class Scope
- :: for Global Data
- Static Class Members
- Initialization of Static Member
- Static Function Class Members
- Access Control
- Friend Functions
- Invoking Member and Friend Functions
- Implementing a Friend Function
- Efficiency and Friend Functions
- Introduction to Inheritance
- Inheritance Concept
- Inheritance in C++
- Employee Test Program
- Protected Members
- Best Class Initializer List
- Composition
- Member Initializer List
- Order of Initialization
- Inheritance vs. Composition
- Polymorphism and Virtual Functions
- A Case for Polymorphism
- Dynamic Binding
- Pointer Conversion in Inheritance
- Polymorphism Using Dynamic Binding
- Virtual Function Specification
- Invoking Virtual Functions
- Vtable
- Virtual Destructors
- Abstract Class Using Pure Virtual
- Function
- Employee as an Abstract Class
- Heterogeneous Collections
- ANSI C++ Library
- ANSI C++ Library
- Hello ANSI C++
- C++ Programming for C Programmers
- Namespaces
- ANSI C++ String Class
- Templates
- Templates
- General Purpose Functions
- Macros oFunction Templates
- Template Parameters
- Template Parameter Conversion
- Generic Programming
- General Purpose Classes
- Class Templates
- Array Class Implementation (array.h)
- Using the Array Template
- Template Parameters
- Class Template Instantiation
- Non Type Parameter Conversion
- Standard Template Library
- STL Components
- STL Elements of a Simple Program
- Simple STL Program
- Map Container
- Input/ Output in C++
- Input/ Output in C++
- Built-in Stream Objects
- Output Operator <<
- Input Operator >>
- Character Input
- String Input
- Formatted I/O
- Streams Hierarchy (Simplified)
- File I/O
- File Opening
- Integer File Copy
- Character File Copy
- Overloading Stream Operators
- Implementing Overloaded Stream
- Operators
- Practical Aspects of C++
- Programming
- Interfacing C++ to Other Languages
- Calling C from C++
- _cplusplus Macro
- Calling C++ from C
- Interface Module for Stack Class
- Namespace Collisions
- ANSI Namespace
- Reliability Philosophies of Languages
- Prototypes and Type Checking
- Constant Types
- Access Control in C++
- Reviews and Inspections
- Inspections and C++
- Testing Strategies for C++
- Performance Considerations
- Class Libraries
- Exception Handling
- Exception Handling
- Try and catch
- Exception Flow of Control
- Context and Stack Unwinding
- Handling Exception in Best Context
- Benefits of Exception Handling
- Unhandled Exceptions
- Clean Up
- Multiple Catch Handlers
- Runtime Type Information
- Runtime Type and Polymorphism
- type_info Class
- typeid Operator
- Compiler Options
- Safe Pointer Conversions
- Dynamic Cast
- New C++ Style Casts
- Static Cast
- Reinterpret Cast
- Const Cast
- Concepts of Object-Oriented Programming
- Object
- State and Behavior
- Abstraction
- Encapsulation
- Class and Instantiation
- Abstract Data Types
- Methods
- Invoking Methods
- Messages
- Class Inheritance
- Polymorphism
- Classes in C++
- Data Encapsulation in C
- The C++ Class
- Structures and Class in C++
- Implementation of a C++ Class
- This Pointer
- Code Organization
- Scope Resolution Operator
- Abstract Data Types
- Test Programs for C++ Classes
- Functions in C++
- Function Prototypes in C++
- Strong Type Checking
- Conversion of Parameters
- Inline Functions
- Inline Functions in Header Files
- Default Arguments
- Function Overloading
- Argument Matching
- Argument Matching through Promotion
- Match through Type Conversion
- Call by Value
- Constructors and Destructors
- The Problem of Initialization
- Constructors and Initialization
- Constructor in Stack Class
- Object Creation and Destruction
- Destructors
- Multiple Constructors
- String Class Implementation
- Hidden Constructors
- C++ Programming for C Programmers
- Using a Default Argument
- Memory Management in C++
- Why is Memory Management Important in C++?
- Choices for an Object’s Memory
- Typical Memory Layout
- Free Store Allocation
- New Operator
- Memory Allocation Errors
- New vs. Malloc
- Delete Operator
- Destructor (Review)
- Hiding Memory Management
- String Class Specification (Version 2)
- String Class Implementation
- String Class Bug
- References and Argument Passing in
- C++
- Variables
- Argument Passing
- Call-by-Value
- Reference Declarations
- Call-by-Reference
- Copy Constructor
- Default Copy Constructor
- Bug in String Class
- Specification of String Class
- Implementation of String Class
- Test Program
- Output of Test Program
- Review of Constant Types
- Constants and Arguments
- Chains of Functions Calls
- Const Objects and Member Functions
- Operator Overloading, Initialization and Assignment Operator Overloading
- Operator Functions
- Semantics of return
- Returning a Temporary Object
- Returning a Reference oInitialization vs. Assignment
- Semantics of Assignment oAssignment
- Assignment Bug
- Overloading =
- Review of this Pointer
- Type Conversions
- Conversion by Construction
- Overloading Cast Operator
- Test Program
- Scope and Access Control
- Scoping in C++
- Block and Function Scope
- File and Global Scope
- Class Scope
- Constant Types and Scope
- Enumeration Types
- Enumeration Types and Class Scope
- :: for Global Data
- Static Class Members
- Initialization of Static Member
- Static Function Class Members
- Access Control
- Friend Functions
- Invoking Member and Friend Functions
- Implementing a Friend Function
- Efficiency and Friend Functions
- Introduction to Inheritance
- Inheritance Concept
- Inheritance in C++
- Employee Test Program
- Protected Members
- Best Class Initializer List
- Composition
- Member Initializer List
- Order of Initialization
- Inheritance vs. Composition
- Polymorphism and Virtual Functions
- A Case for Polymorphism
- Dynamic Binding
- Pointer Conversion in Inheritance
- Polymorphism Using Dynamic Binding
- Virtual Function Specification
- Invoking Virtual Functions
- Vtable
- Virtual Destructors
- Abstract Class Using Pure Virtual
- Function
- Employee as an Abstract Class
- Heterogeneous Collections
- ANSI C++ Library
- ANSI C++ Library
- Hello ANSI C++
- C++ Programming for C Programmers
- Namespaces
- ANSI C++ String Class
- Templates
- Templates
- General Purpose Functions
- Macros oFunction Templates
- Template Parameters
- Template Parameter Conversion
- Generic Programming
- General Purpose Classes
- Class Templates
- Array Class Implementation (array.h)
- Using the Array Template
- Template Parameters
- Class Template Instantiation
- Non Type Parameter Conversion
- Standard Template Library
- STL Components
- STL Elements of a Simple Program
- Simple STL Program
- Map Container
- Input/ Output in C++
- Input/ Output in C++
- Built-in Stream Objects
- Output Operator <<
- Input Operator >>
- Character Input
- String Input
- Formatted I/O
- Streams Hierarchy (Simplified)
- File I/O
- File Opening
- Integer File Copy
- Character File Copy
- Overloading Stream Operators
- Implementing Overloaded Stream
- Operators
- Practical Aspects of C++
- Programming
- Interfacing C++ to Other Languages
- Calling C from C++
- _cplusplus Macro
- Calling C++ from C
- Interface Module for Stack Class
- Namespace Collisions
- ANSI Namespace
- Reliability Philosophies of Languages
- Prototypes and Type Checking
- Constant Types
- Access Control in C++
- Reviews and Inspections
- Inspections and C++
- Testing Strategies for C++
- Performance Considerations
- Class Libraries
- Exception Handling
- Exception Handling
- Try and catch
- Exception Flow of Control
- Context and Stack Unwinding
- Handling Exception in Best Context
- Benefits of Exception Handling
- Unhandled Exceptions
- Clean Up
- Multiple Catch Handlers
- Runtime Type Information
- Runtime Type and Polymorphism
- type_info Class
- typeid Operator
- Compiler Options
- Safe Pointer Conversions
- Dynamic Cast
- New C++ Style Casts
- Static Cast
- Reinterpret Cast
- Const Cast