Sign up to track your progress
Create an account to save your progress, complete exercises, and earn achievements.
C++ (plus)
Dive deeper into object-oriented programming concepts in C++. Learn about classes, objects, inheritance, polymorphism, and advanced C++ features like templates and the Standard Template Library.
Building on your C++ fundamentals, this intermediate course dives deep into object-oriented programming. You'll learn to design and implement classes, understand inheritance hierarchies, work with polymorphism, and explore advanced C++ features. Perfect for developers ready to write more sophisticated C++ applications.
Support Free C++ Education
Help us keep this platform free for everyone! Your support enables us to create more high-quality lessons, exercises, and interactive content.
Course Curriculum
Type Systems and Automatic Type Inference (10 lessons)
Let the compiler deduce types and understand how implicit conversions work.
Automatic Type Conversions in C++
Understand when the compiler automatically converts between types and potential pitfalls.
20 minutes
Numeric Type Promotions
Understand how small integer and floating-point types are widened in expressions.
20 minutes
Converting Between Numeric Types
Convert between integer and floating-point types while avoiding data loss.
25 minutes
Safe Initialization and Narrowing Conversions
Prevent accidental data loss using brace initialization that rejects narrowing.
20 minutes
Mixed-Type Arithmetic Conversions
Predict what type results when mixing different numeric types in an expression.
20 minutes
Manual Type Casting Techniques
Convert types explicitly with static_cast and understand why C-style casts are dangerous.
25 minutes
Creating Type Aliases for Clarity
Give complex types readable names using typedef and the modern using keyword.
30 minutes
Automatic Type Deduction with auto
Let the compiler infer variable types from their initializers with auto.
25 minutes
Function Return Type Deduction
Let the compiler deduce function return types from return statements.
20 minutes
Type Systems and Automatic Type Inference Summary
Review and test your understanding of all type system and type inference concepts covered in this chapter.
25 minutes
References (1 resources)
Additional reference materials for this chapter
Type Inference Terminology
Overview of type system and inference concepts in this chapter.
References and Memory Addresses (16 lessons)
Access and manipulate data indirectly through references and pointers.
Building Complex Types from Simple Ones
Combine fundamental types into references, pointers, arrays, and user-defined types.
20 minutes
Understanding Lvalues and Rvalues
Understand value categories (lvalues and rvalues) for efficient resource management in modern C++.
25 minutes
Creating References to Objects
Create aliases to existing objects that cannot be reseated to refer elsewhere.
25 minutes
Read-Only References with const
Bind references to rvalues and prevent modification of referenced objects.
25 minutes
Efficient Parameter Passing by Reference
Avoid copying large objects by passing them by reference to functions.
25 minutes
Read-Only Parameter Passing
Pass objects efficiently without allowing the function to modify them.
30 minutes
Understanding Memory Addresses and Pointers
Store memory addresses in pointer variables and access data through them.
35 minutes
Representing Absent Pointers with nullptr
Represent absent pointers with nullptr and check for validity before dereferencing.
30 minutes
Const Correctness with Pointers
Distinguish between pointers to const data and const pointer variables.
20 minutes
Parameter Passing with Pointers
Pass pointers to functions when you need optional parameters or C API compatibility.
25 minutes
Advanced Pointer Parameter Techniques
Handle null pointer arguments and modify pointer parameters themselves.
20 minutes
Returning References and Pointers from Functions
Return references or pointers from functions without copying, while avoiding dangling issues.
30 minutes
Parameter Passing Conventions
Design function parameters for input-only, output-only, or bidirectional data flow.
20 minutes
Auto Type Deduction with Pointers and References
Understand how auto interacts with pointer, reference, and const qualifiers.
30 minutes
Representing Optional Values with std::optional
Safely represent values that may or may not exist without using null pointers.
30 minutes
References and Memory Addresses Summary
Review and test your understanding of all reference and memory address concepts covered in this chapter.
30 minutes
References (1 resources)
Additional reference materials for this chapter
References and Pointers Terminology
Overview of reference and memory address concepts in this chapter.
Custom Data Types with Enums and Structs (16 lessons)
Define named constants with enums and group related data with structs.
Defining Enumeration Types
Create named integer constants that improve code readability and type safety.
30 minutes
Converting Enumerations to Integers
Convert enumerators to and from integers for storage and arithmetic operations.
25 minutes
String Conversion for Enumerations
Convert enumerators to human-readable strings for output and debugging.
20 minutes
Custom Input/Output with Operator Overloading
Enable your custom types to work with std::cout and std::cin.
25 minutes
Type-Safe Enumerations with enum class
Use enum class for strongly-typed enumerations that prevent implicit conversions.
25 minutes
Grouping Data with Structs
Bundle related variables together into a single composite type.
20 minutes
Initializing Struct Members
Initialize all struct members at once using brace initialization syntax.
25 minutes
Providing Default Member Values
Specify default values for struct members that apply when not explicitly initialized.
20 minutes
Struct Parameter and Return Techniques
Pass structs to functions by value or reference and return them from functions.
25 minutes
Additional Struct Features and Best Practices
Use nested structs, struct size/alignment, and other advanced struct features.
20 minutes
Accessing Members Indirectly
Access struct members through pointers using the arrow operator (->).
20 minutes
Generic Types with Class Templates
Create structs and classes that work with any data type using templates.
30 minutes
Automatic Template Argument Deduction
Let the compiler deduce template arguments from constructor parameters.
25 minutes
Creating Template Type Aliases
Learn how to write generic, reusable code using alias templates.
20 minutes
Custom Data Types with Enums and Structs Summary
Review and test your understanding of all enum and struct concepts covered in this chapter.
25 minutes
References (1 resources)
Additional reference materials for this chapter
Enums and Structs Terminology
Overview of enumeration and struct concepts in this chapter.
Advanced Function Techniques and Templates (11 lessons)
Write reusable code with function overloading and generic function templates.
Function Overloading
Define multiple functions with the same name but different parameter types.
20 minutes
Overload Differentiation
Understand which parameter differences allow function overloading.
20 minutes
Overload Resolution
Predict which overload the compiler selects and resolve ambiguity errors.
25 minutes
Function Templates
Write a single function that works with any type using template parameters.
20 minutes
Template Instantiation
Understand how the compiler generates concrete functions from templates.
20 minutes
Non-Type Template Parameters
Parameterize templates with compile-time constant values like integers.
20 minutes
Templates in Multiple Files
Organize template definitions in headers for use across translation units.
20 minutes
Advanced Function Techniques and Templates Summary
Review and test your understanding of all advanced function and template concepts covered in this chapter.
30 minutes
References (1 resources)
Additional reference materials for this chapter
Function Templates Terminology
Overview of function overloading and template concepts in this chapter.
Compile-Time Function Evaluation (5 lessons)
Move computation from runtime to compile time for better performance.
Compile-Time Function Evaluation
Write functions that can be evaluated at compile time when given constant arguments.
20 minutes
Advanced constexpr Function Techniques
Use loops, local variables, and other features inside constexpr functions.
25 minutes
Immediate Functions with consteval
Force compile-time evaluation with consteval and detect compile-time context.
25 minutes
constexpr Function Best Practices
Apply best practices for writing maintainable constexpr code.
25 minutes
Compile-Time Function Evaluation Summary
Review and test your understanding of all compile-time function evaluation concepts covered in this chapter.
20 minutes
References (1 resources)
Additional reference materials for this chapter
Constexpr Terminology
Overview of compile-time function evaluation concepts in this chapter.
Advanced Class Concepts and Techniques (11 lessons)
Use static members, friend functions, and other advanced class features.
The this Pointer and Method Chaining
Access the current object with this and enable fluent interfaces with method chaining.
25 minutes
Organizing Class Definitions
Split class definitions between header and source files for better compilation.
30 minutes
Defining Types Within Classes
Define enums, typedefs, and classes inside another class for encapsulation.
20 minutes
Resource Cleanup with Destructors
Clean up resources automatically when objects go out of scope.
20 minutes
Implementing Generic Class Behavior
Define member functions for class templates both inside and outside the class.
20 minutes
Class-Level Data with Static Members
Share data across all instances of a class with static member variables.
25 minutes
Class-Level Functions
Define functions that operate on class-level data without an object instance.
20 minutes
Granting External Function Access
Grant non-member functions access to private class members.
25 minutes
Cross-Class Access with Friend Declarations
Allow one class to access the private members of another class.
20 minutes
Overloading Based on Object Value Category
Provide different behavior for lvalue and rvalue objects using & and && qualifiers.
15 minutes
Advanced Class Concepts and Techniques Summary
Review and test your understanding of all advanced class concepts covered in this chapter.
20 minutes
References (1 resources)
Additional reference materials for this chapter
Advanced Class Terminology
Overview of advanced class concepts and techniques in this chapter.
Resizable Arrays with std::vector (13 lessons)
Store collections of elements that can grow and shrink dynamically.
Storing Collections of Data
Understand container types and when to use arrays versus other collections.
30 minutes
Creating Dynamic Arrays with std::vector
Create vectors with various constructors and initialize them with data.
35 minutes
Index Type Considerations for std::vector
Handle signed/unsigned mismatches when indexing vectors with size_t.
20 minutes
Efficient Vector Parameter Passing
Pass vectors to functions by reference to avoid expensive copies.
20 minutes
Returning Vectors Efficiently
Return vectors from functions efficiently using move semantics.
20 minutes
Iterating Through Array Elements
Use for and while loops to process each element in an array.
20 minutes
Array Iteration Patterns and Solutions
Apply practical patterns to handle signed/unsigned index conversions.
20 minutes
Simplified Iteration with Range-Based For
Iterate over container elements cleanly without managing indices.
20 minutes
Type-Safe Array Indexing with Enums
Use enum values as descriptive, type-safe array indices.
20 minutes
Managing Vector Size and Memory
Understand std::vector resizing and capacity for efficient data storage and manipulation.
20 minutes
The Specialized bool Vector
Recognize the quirks and limitations of the space-optimized bool specialization.
15 minutes
Resizable Arrays with std::vector Summary
Review and test your understanding of all std::vector and resizable array concepts covered in this chapter.
30 minutes
References (1 resources)
Additional reference materials for this chapter
Vector Terminology
Overview of std::vector and resizable array concepts in this chapter.
Fixed-Size Arrays and C-Style Arrays (14 lessons)
Work with compile-time sized arrays and legacy C-style array syntax.
Fixed-Size Arrays with std::array
Use the safer, fixed-size array wrapper from the standard library.
20 minutes
Working with std::array Size and Indices
Access elements and query size with bounds-checked and unchecked methods.
15 minutes
std::array Parameter and Return Techniques
Pass fixed-size arrays to functions using templates or references.
25 minutes
Working with std::array of Custom Types
Initialize arrays of objects with nested braces and understand elision rules.
20 minutes
Using Enumerations with std::array
Use enum values to create descriptive, self-documenting array indices.
20 minutes
Understanding Legacy C Arrays
Understand built-in array syntax and its limitations compared to std::array.
25 minutes
Array-to-Pointer Conversion
Understand how arrays convert to pointers when passed to functions.
35 minutes
Navigating Memory with Pointer Arithmetic
Calculate memory addresses and access elements using pointer offsets.
30 minutes
Null-Terminated Character Arrays
Work with null-terminated character arrays from C legacy code.
25 minutes
Working with Multi-Dimensional C Arrays
Create and access 2D and 3D arrays using C-style syntax.
25 minutes
Fixed Multi-Dimensional Arrays
Create nested std::array types for multi-dimensional fixed-size storage.
30 minutes
Fixed-Size Arrays and C-Style Arrays Summary
Review and test your understanding of all fixed-size array and C-style array concepts covered in this chapter.
30 minutes
References (1 resources)
Additional reference materials for this chapter
Arrays Terminology
Overview of fixed-size and C-style array concepts in this chapter.