Skip to content

L) Zasada 5 (3)

kalinosia edited this page Mar 13, 2021 · 1 revision

„If your class needs custom destructor, copy constructor, or assignment operator, then most likely you have to explicitly define all of them.”​ *since C++11, we also have to take care of move constructor and move assignment operator.

WHY?!

because when in constructor (exapmle default) we give some ptr and we don't have copy constructor, while coping we don't get ptr. In destructor we have delete ptr. So what will happen when we call destructor while don't have ptr (from coping..).

Try delete something not exist.

Clone this wiki locally