[C++-sig] Re: Wrapping Just an Abstract Base
David Abrahams
dave at boost-consulting.com
Sat Jul 26 13:29:59 CEST 2003
Thomas Muldowney <temas at box5.net> writes:
> I'm having a mental breakdown on this one. I have a factory returning a
> pointer to an abstract base class that I've wrapped.
Abstract* factory();
> However, I can't logically wrap the actual derived class because
> it's generated in a plugin.
What do you mean by "plugin"? Some other extension module?
> So, when I go to make a call on one of the abstract functions it
"pure virtual"-------------------^^^^^^^^?
> fails with an AttributeError exception. Is there anyway to handle
> this in a clean manner that keeps the API near the C++ API?
class_<Abstract, non_copyable>("Abstract", no_init)
.def("pure_virtual_function1", &Abstract::pure_virtual_function1)
.def("pure_virtual_function2", &Abstract::pure_virtual_function2)
...
;
??
> I've played around with writing wrapper functions (taking the base
> class pointer) that are defined on the class using the same name as
> the virtual function. Sadly, from my mailing list searches on this
> subject it seems this is a bad idea and can possibly lead to lookup
> loops?
Please post some code which illustrates what you're doing. I'm sure
it's unneccessary, but I can't quite understand it either.
> It does seem to run properly, though. Would love some feedback or a
> kick in the head if I'm missing something in the docs and sites.
Sorry, remote cranial kicks cost extra.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list