Defensive C++: Writing Defensive C++ Code
C++ 20
| Intermediate
- 12 Videos | 1h 34m 33s
- Includes Assessment
- Earns a Badge
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 coursewrite C++ code incorporating defensive techniquesspecify constructors that leave your object in a valid stateuse the const keyword early and often to identify methods that don't update member variablesoverride virtual functions to take advantage of runtime polymorphismidentify situations where object slicing is likely to occur
-
use the right type of cast for your use caseuse the right type of cast when you need additional checksmanage memory correctly even when exceptions occur in codewrite code to avoid the static initialization order fiascouse the right technique to access elements of a collectionsummarize the key concepts covered in this course
IN THIS COURSE
-
1.Course Overview1m 42sUP NEXT
-
2.Writing Defensive C++ Code7m 6s
-
3.Specifying Valid Constructors11m 4s
-
4.Using the const Keyword8m 41s
-
5.Overriding Virtual Functions9m 34s
-
6.Understanding Object Slicing10m 31s
-
7.Using C-style Casts vs. static_cast<>10m 26s
-
8.Using dynamic_cast<>3m 30s
-
9.Managing Memory in the Presence of Exceptions11m 57s
-
10.Fixing the Static Initialization Order Fiasco12m 6s
-
11.Using the at() Method vs. the operator[]6m 14s
-
12.Course Summary1m 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.