fork(22) download
  1. #include <iostream>
  2. #include <typeinfo>
  3. using namespace std;
  4.  
  5. struct Resource {
  6. virtual ~Resource() = default;
  7. };
  8.  
  9. struct Texture : Resource {};
  10.  
  11. int main() {
  12. Resource *resource = new Resource;
  13. Resource *texture = new Texture;
  14.  
  15. cout << typeid(*resource).name() << endl; // yields 'Resource'
  16. cout << typeid(*texture).name() << endl; // yields 'Texture'
  17. return 0;
  18. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
8Resource
7Texture