I try to access in a C program data received from a C++ library which has been originally designed with structure inheritance:
example:
// C++ data structures
typedef struct _Base
{
public:
int id;
wchar_t* name;
} Base;
typedef struct _Struct1 : Base
{
public:
int valueCount;
} Struct1;
typedef struct _Struct2 : Base
{
public:
int parentID;
int amount;
} Struct2;
I tried using the following data structures in C for mapping.
typedef struct _Base
{
int id;
wchar_t* name;
} Base;
typedef struct _Struct1
{
// Base struct data
int id;
wchar_t* name;
int valueCount;
} Struct1;
typedef struct _Struct2
{
// Base struct data
int id;
wchar_t* name;
int parentID;
int amount;
} Struct2;
But printing the data, it looks like I get wrong values.
Am I missing something, any reference on how C++ represents inherited structure internally?
Thanks in advance!