Posts

Using the Copy Assignment Operator to copy objects that have raw pointers.

Listen to this article: https://youtu.be/MdGPC9C5QEI According to cplusplus.com: "A copy constructor is a special constructor for a class/struct that is used to make a copy of an existing instance." The Implicit Copy Constructor      If a copy constructor is not declared, the compiler will use a default one implicitly. The default constructor performs a member-wise copy of the source object. This means that each member is initialized using the corresponding member of the initializer.     Problem: Raw pointers.      If the object contains raw pointers, a member-wise copy may not be appropriate for use. This can cause problems with dangling pointers, double frees, and other undefined behaviour resulting from destructing objects.     Solution: Deep copy.      We explicitly define our own copy constructor when we want to perform a deep copy. That is, instead of copying the pointer, our copy constructor will copy what the po...

C++: Automatic Storage Duration and Static Storage Duration.

Image
https://github.com/pereiradaniel/CPP_CRASH_COURSE/blob/master/P1C4/storage_duration.cpp

C++: Championship Linked List example by adding const correctness, usage...

Image
https://github.com/pereiradaniel/CPP_CRASH_COURSE/blob/master/P1C3/championship_linked_list.cpp

C++: Linked List of F1 World Championships.

Image
https://github.com/pereiradaniel/CPP_CRASH_COURSE/blob/master/P1C3/championship_linked_list.cpp

C: Organizing F1 Team data into structs.

Image

C++: Improving the F1 driver's scoring point system by adding private an...

Image
https://github.com/pereiradaniel/CPP_CRASH_COURSE/blob/master/P1C2/f1points.cpp

Calculating Max Verstappen's total points so far in the 2024 Formula 1 s...

Image