Top "Instanceof" questions

instanceof is an operator available in some object-oriented languages, including Java, php and JavaScript.

PHP check for instance of DateTime?

Is this the only way to check if an object is an instance of a class, in my case of …

php class instance instanceof isinstance
Check if an object is instance of List of given class name

Given an Object o and a String className = "org.foo.Foo", I want to check if o is instance of …

java generics instanceof type-erasure
Java: instanceof Generic

Isn't there any way to find the class-type of a generic? if (T instanceof String) { // do something... } The above definitely …

java generics instanceof
Does instanceof return true if instance of a parent?

I have a class Child that extends Parent. Parent child = new Child(); if (child instanceof Parent){ // Do something } Does this …

java oop inheritance polymorphism instanceof
Checking if a class is java.lang.Enum

I'm trying to know if a class is an Enum, but I think I'm missing something: if (test.MyEnum.class …

java enums instanceof
instanceof - incompatible conditional operand types

The following compiles fine: Object o = new Object(); System.out.println(o instanceof Cloneable); But this doesn't: String s = new …

java instanceof cloneable
why instanceof does not work with Generic?

Possible Duplicate: Java: Instanceof and Generics I am trying to write a function which cast a generic List to specific …

java generics typeerror instanceof
typescript MyObject.instanceOf()

All of our typescript classes inherit (directly or indirectly) from: export class WrObject { className:string; public instanceOf(name : String) : boolean { …

typescript instanceof
Check if a object is a instance of a class (but not a instance of its subclass)

For this example: public class Foo{} public class Bar extends Foo{} .... void myMethod(Foo qux){ if (checkInstance(qux,Foo.class)){ .... } } …

java instanceof
typeof for RegExp

Is there anyway to detect if a JavaScript object is a regex? For example, I would like to do something …

javascript regex constructor instanceof typeof