python - How to enable Swig to emit C++ super class -
i try use overrides functions in python, part of cpp class.
class { public: int func() { return 0; }; a(); }; class b : { public: b(); ~b(); };
i use following command generate swig python file
swig -python -fvirtual -modern -keyword -w511 -module a_swig -outdir . -c++ -i. a_swig.i
but see python file being generated:
class a(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='the membership flag') __repr__ = _swig_repr def func(self): return _iris_swig.a_func(self) def __init__(self): = _a_swig.new_a() try: self.this.append(this) except __builtin__.exception: self.this = __swig_destroy__ = _a_swig.delete_a __del__ = lambda self: none a_swigregister = _a_swig.a_swigregister a_swigregister(a) class b(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='the membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): = _a_swig.new_b(*args, **kwargs) try: self.this.append(this) except __builtin__.exception: self.this = __swig_destroy__ = _iris_swig.delete_b __del__ = lambda self: none packet_header_iris_swigregister = _iris_swig.packet_header_iris_swigregister packet_header_iris_swigregister(packet_header_iris)
i want see b being extended a, can use b.func() in python
class b (a): ...
is there i'm missing?
class b privately inherits a, swig can't represent in python. change public inheritance , see relationship you're hoping for.
Comments
Post a Comment