aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/examples/eina_model_04_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/examples/eina_model_04_main.c')
-rw-r--r--libraries/eina/src/examples/eina_model_04_main.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/libraries/eina/src/examples/eina_model_04_main.c b/libraries/eina/src/examples/eina_model_04_main.c
deleted file mode 100644
index 0e419ec..0000000
--- a/libraries/eina/src/examples/eina_model_04_main.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * main_animal.c
3 * compile with: gcc eina_model_04_*.c -o eina_model_04 `pkg-config --cflags --libs eina`
4 */
5
6/*
7 * This example demonstrates the extended usage of Eina Model.
8 * Class inheritance and interface implementation
9 *
10 * Animal Class is inherited from BaseClass and implements
11 * "_breathe_animal()" and "_eat_animal()" methods.
12 *
13 * Human Class is inherited from Animal class.
14 * Parrot Class is inherited from Animal class.
15 *
16 * Child Class is inherited from Human class.
17 *
18 * Human Class and Parrot Class implement Whistler Interface.
19 * Human Class implements Diver Interface. Diver Interface inherited from Swimmer Interface
20 *
21 *
22 * Animal Class (inherited from Base Class)
23 * + _breathe_animal()
24 * + _eat_animal()
25 * / -------/ \-------------\
26 * / \
27 * Human Class Parrot Class
28 * inherits inherits
29 * + animal_breathe() + animal_breathe()
30 * overrides overrides
31 * + animal_eat(); + animal_eat();
32 * implements implements
33 * + human_walk(); + parrot_fly();
34 *
35 * implements Whistler, Swimmer, implements Whistler,
36 * Diver Interfaces: + whistler_whistle()
37 * + whistler_whistle()
38 * + swimmer_swim()
39 * + diver_dive()
40 *
41 * ----------------------------------------------------------
42 * | Swim_Interface |
43 * | + swim() |
44 * | | |
45 * | | |
46 * | Dive Intarface (inherited from Swim Interface) |
47 * | + dive() |
48 * ---------------------------------------------------------
49 * |
50 * |
51 * Child Class
52 * + inherits all parent's methods
53 * + implements cry_child()
54 * + overrides dive() interface method
55 */
56
57#include <Eina.h>
58#include "eina_model_04_human.h"
59#include "eina_model_04_parrot.h"
60#include "eina_model_04_child.h"
61#include "eina_model_04_whistler.h"
62
63int
64main()
65{
66 Eina_Model *h, *p, *c;
67
68 eina_init();
69
70 human_init();
71 parrot_init();
72 child_init();
73
74 h = eina_model_new(HUMAN_TYPE);
75 p = eina_model_new(PARROT_TYPE);
76 c = eina_model_new(CHILD_TYPE);
77
78 animal_breathe(p);
79 animal_eat(p);
80 parrot_fly(p);
81 whistler_whistle(p);
82
83 printf("\n");
84 animal_breathe(h);
85 animal_eat(h);
86 human_walk(h);
87 whistler_whistle(h);
88 swimmer_swim(h);
89 diver_dive(h);
90
91 printf("\n");
92 animal_breathe(c);
93 animal_eat(c);
94 human_walk(c);
95 whistler_whistle(c);
96 swimmer_swim(c);
97 diver_dive(c);
98 child_cry(c);
99
100 eina_model_unref(c);
101 eina_model_unref(h);
102 eina_model_unref(p);
103
104 eina_shutdown();
105
106 return 0;
107}
108
109
110