Table of Contents
- Introduction
- Copy and Move
- Resource Management
- Conventional Operations
Introduction
- An object can be copied or moved in five different cases:
- How does assignment use a copy or move operation?
- How does the compiler optimize copy operations using Return Value Optimization (RVO)?
class Example {
int a;
double b;
std::string c;
public:
Example() = default;
};
- Write a default copy constructor for this class.
- When would we purposefully specify
= default
for constructor
- Why must we explicitly define copy and move operations for a class with pointers?
- What is the Rule of Zero in C++?
- How do we prevent a constructor from being generated?
- Why do we use
explicit
for single-parameter constructors?
- How can implicit conversion cause unexpected behavior, and how do we prevent it?