A few minutes after this post, I've realized that Block::init_type() must be called in module initialization, and not in Gain::init_type(), but the same thing happens.


---------- Forwarded message ----------
From: Fernando Libonati <fernando.libonati@gmail.com>
Date: 2010/4/10
Subject: Derived class getattro
To: Discuss PyCXX use and improvement <cxx-users@lists.sourceforge.net>

In cxx_extensions.cxx


In a derived class this always call the getattro of the base class, and never get the derived class attributes visible.
How can I access a derived class attro?

I've attached the test system, base.h and base.cxx.
When compiled, it is possible to create a g = base.Gain("b",1,None,2.43) object, and access name,number and parent attributes, but doesn't reach the gain attribute.
Python says
"""Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Gain' object has no attribute 'gain'

It would be possible to call first the derived class method, and inside it call the base class method (under the user responsibility)?

Fernando Libonati
fernando.libonati at gmail.com

Fernando Libonati
fernando.libonati at gmail.com