bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/GObject_tutorial
1
by Gustav Hartvigsson
First lesson. |
1 |
#include "animal.h" |
2 |
#include "cat.h" |
|
3 |
#include "dog.h" |
|
4 |
||
5 |
||
6 |
||
7 |
int
|
|
8 |
main (char ** argv, int argc){ |
|
9 |
TestAnimal * a = test_animal_new (); |
|
10 |
TestCat * c = test_cat_new (); |
|
11 |
TestDog * d = test_dog_new (); |
|
12 |
|
|
13 |
test_animal_make_sound (a); |
|
14 |
test_animal_move (a, 5, 6); |
|
15 |
|
|
16 |
test_animal_make_sound (TEST_ANIMAL(c)); |
|
17 |
test_animal_move (TEST_ANIMAL(c), 7, 2); |
|
18 |
|
|
19 |
test_animal_make_sound (TEST_ANIMAL(d)); |
|
20 |
test_animal_move (TEST_ANIMAL(d), 4, 8); |
|
21 |
|
|
22 |
g_object_unref (c); |
|
23 |
g_object_unref (d); |
|
24 |
g_object_unref (a); |
|
25 |
|
|
26 |
return 0; |
|
27 |
}
|