right or leftans is a object of custom class how can it be null
How object can be null
An object of a class cannot be set to NULL; however, you can set a pointer (which contains a memory address of an object) to NULL.
Cat c;
c = NULL;//Compiling error
Example of what you can do:
Cat c;
//Set p to hold the memory address of the object c
Cat *p = &c;
//Set p to hold NULL
p = NULL;
Similarly
left and right are of self referential type hence can be assigned NULL
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.