Request and Suppress Methods
Explore how to effectively use the default and delete keywords to request or suppress the compiler-generated special methods in C++. Understand their role in managing constructors, destructors, and assignment operators, enabling you to control object creation and behavior in your classes.
We'll cover the following...
We'll cover the following...
Special methods #
Since C++11, there has been a list of special methods that the compiler can generate implicitly if we have not defined them:
-
Default constructors and destructors.
-
Copy/move constructors and copy/move assignment operators.
-
newanddeleteoperators for objects and C arrays of objects. -
The
defaultanddelete...