Re: [C++-sig] how to call base class method?

2011-05-06 Thread zeb
Making a A_get wrapper seems to be the only way to solve this problem. THANK YOU JIM -- View this message in context: http://boost.2283326.n4.nabble.com/how-to-call-base-class-method-tp3504749p3505083.html Sent from the Python - c++-sig mailing list archive at Nabble.com.

[C++-sig] how to call base class method?

2011-05-06 Thread zeb
I have 2 class exposed to python: class A { public: virtual int get() { return 1; } }; class B : public A { public: virtual int get() { return 2; } }; In python: obj = B() obj.get() # this will call B's get() For some reason, I want to call A's get() in python, like obj->A::get() in C++.

Re: [C++-sig] transfer ownership problem

2011-05-05 Thread zeb
Thank you, Jim. ^-^ By using boost::intrusive_ptr, the problem is solved. Everything works well. -- View this message in context: http://boost.2283326.n4.nabble.com/transfer-ownership-problem-tp3495846p3497818.html Sent from the Python - c++-sig mailing list archive at Nabble.com. __

[C++-sig] transfer ownership problem

2011-05-04 Thread zeb
hi, I have some problem about transfer-ownership. C++ code is like this: class RefCounter { int _count; public: RefCounter() : _count(1) {} virtual RefCounter() {} void addRef() { ++_count; } void release() { --_count; if (_count == 0) delete this; } }; class A : public RefCoun

Re: [C++-sig] help on abstract class export

2011-04-29 Thread zeb
Thank you very much. It works! -- View this message in context: http://boost.2283326.n4.nabble.com/help-on-abstract-class-export-tp3483090p3483251.html Sent from the Python - c++-sig mailing list archive at Nabble.com. ___ Cplusplus-sig mailing list Cpl

[C++-sig] help on abstract class export

2011-04-29 Thread zeb
Hi, I'm trying to export the following code to python, but failed. Please help me! Here is the code: -- c++ code: -- class IWorker { public: virtual int getData() = 0; }; class Worker : public IWorker { public: int getData() { return 100;