instanceof ObjectΒΆ

object is a type, but it can also be used as a constant name. Then, instanceof will accept it for testing a variable.

There are some other cases around instanceof, which are surprising upon first read.

We can use a string in a variable, but not a direct string, a constant nor a ::class.

../_images/instanceof_class.png