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

C++ Equivalent to Java 'Object'

In C++17, the std::any type offers a good equivalent to java.lang.Object.

Java C++ (C++17)
java.lang.Object o = 1;
int i = (int)o;
java.lang.Class t = o.getClass();
#include <any>
#include <typeinfo>

std::any o = 1;
int i = std::any_cast<int>(o);
std::type_info t = o.type();


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

Additional resource: Java and C++ Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.