Lca implementation

In this video, he is comparing
an object with Null , which cannot be true,
I dont know if he is writing the pseudo code, because that will through errors,
I understood the logic and prblem. i just need the proper correct code. Please provide me with that.

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, which is the case here.

If you understand the logic and problem, then you can write the code in your own way, otherwise the code provided in the lecture is also fine, but i will suggest you to implement it by yourself.
Hope it helps.

what will the syntax for that?
if O is the object
Im not getting how can i write

O != NULL , IT WONT point to pointer of object or would it??

if it would please explain how?

For example this will give error

Cat c;
c = NULL;//Compiling error

But, doing this
> Cat c;
> //Set p to hold the memory address of the object c
> Cat *p = &c;
> //Set p to hold NULL
> p = NULL;

1 Like