Re: Why won't this cast?
On May 25, 9:58 am, mark <trid...@ihug.co.nz> wrote:
[...]
The typeid.name() for '*sor' & 'SelectedFileObject' returned
'18SelectedFileObject'.
But the typeid(*sor)==typeid(SelectedFileObject) evaluates to false.
I'm just guessing, since I don't know the environment in which
you are working. But you did mention something about the actual
objects being in a plugin. So this really have nothing to do
with C++ (which doesn't support plugins, yet), but are you
loading (under Unix) or building (under Windows) the plugin
correctly, so that its symbols and types are correctly exported
and found by the main program? Or is it a case where the
SelectedFileObject in the plugin is, as far as the program can
tell, totally unrelated to the class of the same name in the
main program.
Normally, a well designed plugin will be built and loaded in a
manner such that most of the symbols in it are NOT visible
outside it---the plugin interface may very well use a type
SelectedObject, which must be common to all plugins, but you
typically don't want conflicts just because two different
plugins decide to use the same name for the derived class---you
want it to be two different classes, as if they really had
different names. And of course, if this is the case,
typeid(...).name() will return the same value for the two
different classes.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34