[C++-sig] Re: pure virtual methods with pyste
wiedeman at gmx.net
wiedeman at gmx.net
Mon Jul 28 11:01:16 CEST 2003
Hi Nicodemus,
>Yes, it follows the procedure in the tutorial about abstract virtual
>functions, ie, it only generates the virtual wrapper. You should still
>be able to override the abstract member functions in Python, though...
>is this the problem you're having?
No, that's not my problem. I want to be able to use pointers to abstract
classes within python without wrapping all the derived classes (in fact, they
are plugins), and, if possible, without writing a call_f function for every
pure virtual method.
I've played around with boost.python and found the solution below
(Test.cpp). With pyste, i'd get an empty class Abstract. I wonder, if my solution is
dangerous or even wrong ?
Thanks in advance,
Christoph
/* Test.cpp */
struct Abstract {
virtual void a() = 0;
};
#include <boost/python.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(myclasses) {
class_<Abstract, AbstractWrap, boost::noncopyable>("Abstract")
.def("a", &Abstract::a)
;
}
More information about the Cplusplus-sig
mailing list