Re: [pygccxml-development] class hierachy with pure virtual .
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2008-08-13 13:00:21
|
On Wed, Aug 13, 2008 at 2:14 PM, Damien Fagnou <dam...@mo...> wrote: > Hi , > > so here is my case : > > /// Module A > /// __BIND__ > class Base > { > /// __BIND__ > void foo() = 0; > } > > /// __BIND__ > class BaseImp : public Base > { > void foo() { // do something default } > } > > /// Module B > /// __BIND__ > class Usefull : public BaseImp > { > void foo() { // do something usefull } > } > > I use doxygen to expose classes or methodes , ///__BIND__ is the trigger . > > Module A and B and build in too different process , and come for > different libs . > Module A is loaded before Module B. > > Class Base shouldnt/cant be overriden in python . I can add new property to class "no_init", which will path "no_init" to boost::python::class_<...> constructor. This will do the trick > > the problem that I am having is that when I call > > Usefull.foo() I get an exeption on calling a pure virtual function . > and its kinda make sense when I look at the wrapper for Base::foo Not for me. Usefull is exposed too, right? You also meant to wrote Usefull().foo(), right ? In this case you should not get "pure virtual function call" exception, because the function has "default" implementation. I think something wrong with the example, you tried to build. May be you have overloaded "foo"? > can I tell py++ that I dont want a pureVirtual to be declare are such ? > also can I force py++ to not enable virtual methods overwriting ? No. The only "hacky" way you can do this, is to change function "virtuality" http://language-binding.net/pyplusplus/documentation/apidocs/pygccxml.declarations.calldef.member_calldef_t-class.html#virtuality but I am not responsible for the result :-) > I guess that I could try to write the implemation of those class > manually but py++ is doign such a good job that I have become very lasy :) :-), Create complete example ( C++ + Python code with desired behavior ) and lets see what could be done -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |