Defensive C++: Writing Defensive C++ Code

C++ 20    |    Intermediate
  • 12 Videos | 1h 39m 33s
  • Includes Assessment
  • Earns a Badge
Likes 4 Likes 4
Writing good, robust, and maintainable C++ code involves understanding the intricacies of the language and avoiding common pitfalls. Use this course to learn more about avoiding fatal coding errors, adopting defensive coding techniques, and following best practices and other code niceties Examine some common coding errors, the correct way to set up constructors in code, and the pitfalls of overriding non-virtual functions. You will also explore object slicing errors, how to cast objects to other types, and the use of smart pointers to manage resources in C++. Finally, you will understand the implications of the static initialization order fiasco in C++ and how you can avoid it. At the end of this course, you will have the knowledge and skills to write robust, defensive C++ code.

WHAT YOU WILL LEARN

  • discover the key concepts covered in this course
    write C++ code incorporating defensive techniques
    specify constructors that leave your object in a valid state
    use the const keyword early and often to identify methods that don't update member variables
    override virtual functions to take advantage of runtime polymorphism
    identify situations where object slicing is likely to occur
  • use the right type of cast for your use case
    use the right type of cast when you need additional checks
    manage memory correctly even when exceptions occur in code
    write code to avoid the static initialization order fiasco
    use the right technique to access elements of a collection
    summarize the key concepts covered in this course

IN THIS COURSE

  • Playable
    1. 
    Course Overview
    1m 42s
    UP NEXT
  • Playable
    2. 
    Writing Defensive C++ Code
    7m 6s
  • Locked
    3. 
    Specifying Valid Constructors
    11m 4s
  • Locked
    4. 
    Using the const Keyword
    8m 41s
  • Locked
    5. 
    Overriding Virtual Functions
    9m 34s
  • Locked
    6. 
    Understanding Object Slicing
    10m 31s
  • Locked
    7. 
    Using C-style Casts vs. static_cast<>
    10m 26s
  • Locked
    8. 
    Using dynamic_cast<>
    3m 30s
  • Locked
    9. 
    Managing Memory in the Presence of Exceptions
    11m 57s
  • Locked
    10. 
    Fixing the Static Initialization Order Fiasco
    12m 6s
  • Locked
    11. 
    Using the at() Method vs. the operator[]
    6m 14s
  • Locked
    12. 
    Course Summary
    1m 43s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion of this course, which can be shared on any social network or business platform

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Likes 39 Likes 39  
Likes 91 Likes 91