Actor == actor, alternative to casting?

This compare pointers if they point to the same object ( Virtual Memory Address ).
It only works if you want to check if it’s the same object.
This is common even in C++.

The actual machine code doesn’t need to worry about type because they don’t need to dereference to class’s member, method etc which need the size of class/address table and offset for dereferencing those.
They can just use the memory address directly for comparing.

1 Like