#include <iostream>
#include <typeinfo>
using namespace std;
struct Resource {
virtual ~Resource() = default;
};
struct Texture : Resource {};
int main() {
Resource *resource = new Resource;
Resource *texture = new Texture;
cout << typeid(*resource).name() << endl; // yields 'Resource'
cout << typeid(*texture).name() << endl; // yields 'Texture'
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZWluZm8+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgUmVzb3VyY2UgewoJdmlydHVhbCB+UmVzb3VyY2UoKSA9IGRlZmF1bHQ7Cn07CgpzdHJ1Y3QgVGV4dHVyZSA6IFJlc291cmNlIHt9OwoKaW50IG1haW4oKSB7CglSZXNvdXJjZSAqcmVzb3VyY2UgPSBuZXcgUmVzb3VyY2U7CglSZXNvdXJjZSAqdGV4dHVyZSA9IG5ldyBUZXh0dXJlOwoJCgljb3V0IDw8IHR5cGVpZCgqcmVzb3VyY2UpLm5hbWUoKSA8PCBlbmRsOyAvLyB5aWVsZHMgJ1Jlc291cmNlJwoJY291dCA8PCB0eXBlaWQoKnRleHR1cmUpLm5hbWUoKSA8PCBlbmRsOyAvLyB5aWVsZHMgJ1RleHR1cmUnCglyZXR1cm4gMDsKfQ==