Posts

Showing posts with the label notes

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...

My Python Notes.

Started learning Python recently by following this tutorial. Here is a link to my notes, which you may or may not find helpful if you are new to Python. The notes are based on the W3 Schools tutorial that I am doing, and I include my own notes and experiments along with them. https://github.com/pereiradaniel/w3_python/blob/master/notes.md