fork download
  1. #include <iostream>
  2. #include <typeinfo>
  3. #include <cxxabi.h>
  4. using namespace std;
  5.  
  6. class O {
  7. public:
  8. virtual void vfunction()
  9. {
  10. cout << "hello";
  11. }
  12. };
  13.  
  14. class C : public O
  15. {
  16. public:
  17. C() {};
  18. };
  19.  
  20.  
  21.  
  22. int main() {
  23. // your code goes here
  24.  
  25. O* varb = new C();
  26.  
  27.  
  28. char *realname;
  29. int status;
  30.  
  31. // exception classes not in <stdexcept>, thrown by the implementation
  32. // instead of the user
  33. realname = __cxxabiv1::__cxa_demangle( typeid(*varb).name(), nullptr, 0, &status );
  34.  
  35. cout << realname << endl;
  36.  
  37. cout << __cxxabiv1::__cxa_demangle( typeid(varb).name(), nullptr, 0, &status );
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
C
O*