Advanced C++ Programming

Advanced C++ Programming

Duration: 5 Days

Description

This course provides an in-depth exploration of advanced C++ programming concepts with a focus on object-oriented design, generic programming, and the Standard Template Library (STL). Learners will examine complex topics such as inheritance, polymorphism, templates, exception handling, and runtime type information, while also gaining hands-on experience in building efficient and reliable C++ applications. Through practical labs and examples, participants will learn how to integrate modern C++ techniques into real-world development scenarios and improve their ability to write robust, reusable, and high-performance code.

Audience

This course is for experienced C++ programmers who wish to deepen their understanding of the language and learn advanced techniques.

Objectives

  • Review intermediate features of C++ such as inheritance and templates
  • Gain a more complete understanding of the issues involved in effective class design
  • Learn important features of C++ such as exception handling, RTTI and multiple inheritance
  • Learn advanced techniques such as smart pointers and reference counting
  • Gain a working knowledge of the Standard Template Library

Prerequisites

Participants should have prior experience with C++ programming, including familiarity with classes, functions, operators, and control structures. A solid understanding of fundamental object-oriented programming concepts such as encapsulation, inheritance, and polymorphism is strongly recommended. Experience writing and compiling basic to intermediate-level C++ applications is expected, as this course builds upon foundational skills to cover more advanced language features and design techniques.

Course Outline

Module 1: Inheritance and Polymorphism

  • Class Derivation
  • Access Control
  • Base Class Initialization
  • Initializing Class Type Members
  • Polymorphism and Virtual Functions
  • Pointer Conversion
  • Virtual Destructors
  • Abstract Classes and Pure Virtual Functions

Module 2: ANSI C++ Library

  • New Header Files
  • Namespaces in the Standard Library
  • ANSI C++ String Classes
  • Templates in the Standard Library

Module 3: Templates

  • C++ Template Mechanism
  • Function Templates
  • Class Templates
  • Generic Programming
  • Implementing a General Array Class
  • Standard Template Library

Module 4: Input/Output in C++

  • Streams I/O Library
  • Formatted Stream I/O
  • File I/O
  • I/O in User Defined Classes

Module 5: Practical Aspects of C++ Programming

  • Interfacing C and C++
  • Namespaces
  • Reliability in C++ Programs
  • Testing Considerations
  • Efficiency Considerations

Module 6: Advanced Polymorphism and Inheritance

  • Orthodox Canonical Form
  • Public, Private and Protected Inheritance
  • Composition vs. Inheritance
  • Templates vs. Inheritance
  • Interface Encapsulation

Module 7: Exception Handling

  • C++ Exception Mechanism
  • Exceptions Compared to Other Error Handling Techniques
  • throw, try and catch
  • Exception Context and Stack Unwinding
  • Uncaught Exceptions
  • Automatic Cleanup in Exception Handling

Module 8: Runtime Type Information

  • Runtime Type Information (RTTI) Mechanism
  • type_info Class and typeid Operator
  • Type Safe Pointer Conversion
  • New C++ Cast Syntax

Module 9: Inheritance Hierarchies and Multiple Inheritance

  • Smalltalk Style Class Hierarchies
  • Collection Classes in Object-Based Hierarchies
  • Independent Class Hierarchies in C++
  • Multiple Inheritance
  • Resolving Ambiguities
  • Duplicate Subobjects
  • Virtual Base Classes
  • RTTI in Multiple Inheritance

Module 10: Applications of C++ Concepts

  • Object Validation
  • Smart Pointers
  • Reference Counting
  • Generic Smart Pointers

Module 11: An Overview of Templates

  • Templates
  • Overloading functions
  • Template functions
  • Specializing a template function
  • Disambiguation under specialization
  • Template classes
  • An array template class
  • Instantiating a template class object
  • Rules for templates
  • Non member function with a template argument
  • Friends of template classes
  • Templates with multiple type parameters
  • Non type parameters for template classes
  • Comments regarding templates

Module 12: Overview of the Standard Template Library

  • Perspective
  • History and evolution
  • New features in C++
  • The Standard Template Library
  • Design goals
  • Header files
  • STL components
  • Containers
  • Algorithms
  • Iterators

Module 13: Examples from STL

  • Example: vectors, lists
  • Example: maps
  • Example: sets
  • Example: multiset
  • Example: find with a vector
  • Example: find with a list
  • Example: merge
  • Iterators
  • Function objects
  • Adaptors

Module 14: STL Containers

  • Vector
  • Deque
  • List
  • The beauty of STL
  • Associative Containers
  • Set
  • Multiset
  • Map
  • Multimap

Module 15: STL Iterators

  • Input Iterators
  • Output Iterators
  • Forward Iterators
  • Backward Iterators