From: Nitro <ni...@dr...> - 2006-10-05 15:16:15
|
Am 04.10.2006, 14:06 Uhr, schrieb andreyl <ala...@ya...>: > > My regards! > > I got C++ class: > class Test > { > public: > Test(int v): val_(v) {} > int GetVal() const { return val_; } > void SetVal(int v) { val_ =3D v; } > > private: > int val_; > }; > > I'd like to call them in Python this way: > tst =3D Test(23) > print tst.val #prints 23 - calling Test::GetVal() const > tst.val =3D 44 # calls Test::SetVal(int) > > can I develop it using SWIG? Sure, check out SWIG/Lib/typemaps/attribute.swg . To use it, just add = %include attribute.i to your own .i file. |