casting example in c
#include <stdio.h>
typedef unsigned char XenonType;
typedef struct {
XenonType type;
} XenonObject;
typedef struct {
XenonType type;
int none;
} XenonNone;
int main()
{
XenonNone g = {4, 0};
XenonNone* d = &g;
XenonObject * f = (XenonObject*)d;
printf("the type is %d\n", f->type);
//the type is 4
XenonNone*a = (XenonNone*)f;
printf("the non is %d\n", a->none);
return 0;
}