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

C++ Equivalent to C# 'object'

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

C# C++ (C++17)
object o = 1;
int i = (int)o;
Type t = o.GetType();
#include <any>
#include <typeinfo>

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


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

Additional resource: C++ and C# Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.