RE: [GD-General] Multiple Inheritance and RTTI
Brought to you by:
vexxed72
From: Alex L. <ali...@au...> - 2003-02-04 23:33:14
|
Has anyone considered comparing the vtable pointers themselves in order to identify a class? As far as I understand it, every polymorphic class is going to have a unique vtable pointer, and while it's compiler dependent, my experience is that the vtable pointer tends to be the first "member" data in every instance. i.e. int vtable = *reinterpret_cast<int*>(someInstancePointer); I'm not too sure about multiple inheritance. One problem is that you need an instance of every class you wish to identify so that you have a value to compare! Some start up function could harvest these from temporary instances. I would love to hear problems with this! Alex Lindsay |