• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C++ Equivalent to the Java 'instanceof' Operator

There is no direct equivalent in C++ to the Java 'instanceof' operator, but you can replicate the behavior by testing the result of a 'dynamic_cast'.

Java C++
boolean b = f instanceof Foo; bool b = dynamic_cast<Foo*>(f) != nullptr;


Use Java to C++ Converter to convert from Java to C++.     

Additional resource: Java and C++ Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.