aboutsummaryrefslogtreecommitdiff
path: root/src/shape.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shape.c')
-rw-r--r--src/shape.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/shape.c b/src/shape.c
new file mode 100644
index 0000000..cb72c05
--- /dev/null
+++ b/src/shape.c
@@ -0,0 +1,32 @@
+#include <stdlib.h>
+#include "shape.h"
+
+struct shape
+{
+ shape_area_t area;
+ shape_destroy_t destroy;
+};
+
+double shape_area(struct shape *shape)
+{
+ return shape->area(shape);
+}
+
+void shape_destroy(struct shape *shape)
+{
+ shape->destroy(shape);
+}
+
+void shape_init(
+ struct shape *shape,
+ shape_area_t area,
+ shape_destroy_t destroy)
+{
+ shape->area = area;
+ shape->destroy = destroy;
+}
+
+int shape_sizeof()
+{
+ return sizeof(struct shape);
+} \ No newline at end of file