J
J
Hi
I am trying to make a C++ class hierarchy accessible to python scripts.
Am I right to assume that the type structure of a derived class must
have all the members of its base class declared as well ?
For example,
typedef struct
{
PyObject_HEAD
int somebaseclassmember;
} PyStructBaseClass
is the structure for a base class. In this case, the structure for a
derived class would have to look like
typedef struct
{
PyObject_HEAD
ScnNode* mObject;
int somebaseclassmember;
float somederivedclassmember
} PyStructDerivedClass;
Is this true ? I have linked the derived class type to the base class
type via tp_base. I don't think that when I instantiate a derived
class, a PyStructBaseClass is being created. I believe that if
PyStructDerivedClass was missing the "int somebaseclassmember;" then
the offset for that memory would point into the float during base class
member lookups .... ???
Any thoughts ?
Cheers
Jochen
I am trying to make a C++ class hierarchy accessible to python scripts.
Am I right to assume that the type structure of a derived class must
have all the members of its base class declared as well ?
For example,
typedef struct
{
PyObject_HEAD
int somebaseclassmember;
} PyStructBaseClass
is the structure for a base class. In this case, the structure for a
derived class would have to look like
typedef struct
{
PyObject_HEAD
ScnNode* mObject;
int somebaseclassmember;
float somederivedclassmember
} PyStructDerivedClass;
Is this true ? I have linked the derived class type to the base class
type via tp_base. I don't think that when I instantiate a derived
class, a PyStructBaseClass is being created. I believe that if
PyStructDerivedClass was missing the "int somebaseclassmember;" then
the offset for that memory would point into the float during base class
member lookups .... ???
Any thoughts ?
Cheers
Jochen