#include <stdio.h> #include "CircleP.h" static void init(Core p); static void draw_circle(Shape shape); CircleClassDescriptor circle_class_descriptor = { /* Core part */ { "Circle", /* class_name */ (CoreClassDescriptor*)&shape_class_descriptor,/* super_class */ sizeof(CircleObj), /* size_of_instance */ NULL, /* class_initializer */ init, /* initializer */ NULL, /* finalizer */ }, /* Shape part */ { draw_circle, /* draw */ }, /* Circle part */ { 0, /* dummy */ }, }; CoreClassDescriptor *circleClass = (CoreClassDescriptor*)&circle_class_descriptor; static void init(Core p) { Circle circle = (Circle)p; circle->circle.center.x = 0.0; circle->circle.center.y = 0.0; circle->circle.radius = 0; printf("circle initialized.\n"); } static void draw_circle(Shape shape) { printf("draw circle!\n"); }