5

How can I find out if an object implements an interface? In other words I need a possibility to check if an object can be cast to a specific type (e.g. a specific interface).

2 Answers 2

9

Std.is(). Or use a safe cast and it will throw an error if it fails.

0
-1

you can try to create the object and catch with a class not found exception i guess.

1
  • i want to check an existing object, if it implements an interface. i can do a cast and catch an exception, but that can't be the ultimate answer...
    – nepa
    Aug 27, 2012 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.