Classes part 3 - Copy Constructor, Copy Assignment(Deep and Shallow Copy) | Modern Cpp Series Ep. 39

Описание к видео Classes part 3 - Copy Constructor, Copy Assignment(Deep and Shallow Copy) | Modern Cpp Series Ep. 39

►Full C++ Series Playlist:    • The C++ Programming Language  
►Find full courses on: https://courses.mshah.io/
►Join as Member to Support the channel:    / @mikeshah  

►Lesson Description: In this lesson I cover the copy constructor, and copy assignment operator. I start by showing how the compiler gives you these two special functions for classes for free, using the compiler generated ones. Unfortunately, this is not sufficient, as when we have to dynamically allocate memory, the trivial copy can result in problems like double frees or unwanted sharing of data. Next I show you how to avoid making these 'shallow' copies, and write your own copy constructor and copy-assignment operators to perform a deep copy.

►YouTube Channel:    / mikeshah  
►Please like and subscribe to help the channel!

Комментарии

Информация по комментариям в разработке