isme destructor samaj nii aya
kya sirf particular node delete hoga aur uske next wale nii ???
ya fir particular node ke baad sare delete honge ??
aur recursively kese hum toh recursive call nii de rhe ???
Destrcutor in hashtable class implementation
using this statement
~Node(){
if(next!=NULL){
delete next;
}
}
when calling delete next;
, you are calling the deconstructor of the next
element, and so on. When next
is NULL
, 0
or nullptr
, the process will stop.