This, unfortunately, doesn't allow me to create an array of pages, independently of their type. And if I create several arrays, I'll have poor compatibility, in case I discover later that there can be one more page type I didn't think of.
And solving the array problem by making GeneralPage a base of Type#, either leads to duplicating the common code for all SpecialPage types, or to diamond inheritance.
Maybe I'm missing...
User Profile
Collapse
-
The real problem in this case seems to be the shared library boundary. dynamic_cast fails because the typeid is unknown to it. If you compile the "SpecialPag e" classes in, everything works. I tried to follow the quidelines GCC has in it's FAQ about shared libraries, but it doesn't help.
I came up with a (really dirty) workaround, where the GeneralPage class has a virtual abstract function, casting the typed base into void,...Leave a comment:
-
plugin system implementation : dynamic_cast through invisible classes
Hello,
I've been writing a program, which works with some special type of files : namely files, containing "pages". Since there are several formats for that type of things, and I'm not likely to know all, I wanted to make the program extensible through external plugins (in shared libraries).
I decided that a plugin will return a pointer to a "general file" object, which, in turn, will contain some...
No activity results to display
Show More
Leave a comment: