#ifndef GRAPHIC_H_INCLUDED #define GRAPHIC_H_INCLUDED /* abstract class gobject */ struct gobject; /* non-virtual methods */ int gobject_get_id(const struct gobject *); /* virtual methods */ void gobject_virtual_print(const struct gobject *); /* virtual call */ void gobject_print(const struct gobject *); /* concrete, non-virtual */ /* No concrete implementations of these virtual methods here. */ float gobject_virtual_area(const struct gobject *); void gobject_virtual_translate(struct gobject *, float x, float y); /* virtual destructor */ void gobject_destroy(struct gobject *); void gobject_virtual_destroy(struct gobject *); /* class point extends gobject */ struct point; struct point * point_new(float x, float y); void point_destroy(struct point *); /* virtual methods */ void point_print(const struct gobject *); /* concrete */ float point_area(const struct gobject *); /* concrete */ void point_translate(struct gobject *, float x, float y); /* concrete */ /* class rectangle extends gobject */ struct rectangle; struct rectangle * rectangle_new(float x1, float y1, float x2, float y2); void rectangle_destroy(struct rectangle *); /* virtual methods */ void rectangle_print(const struct gobject *); /* concrete */ float rectangle_area(const struct gobject *); /* concrete */ void rectangle_translate(struct gobject *, float x, float y); /* concrete */ #endif