1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "dog.h"
struct _TestDog {
TestAnimal parent;
};
G_DEFINE_TYPE (TestDog, test_dog, TEST_TYPE_ANIMAL)
/******************************************************************************/
void
test_dog_real_make_sound (TestDog * self);
void
test_dog_real_move (TestDog * self, gint x, gint y);
/******************************************************************************/
TestDog *
test_dog_new () {
return g_object_new (TEST_TYPE_DOG, NULL);
}
static void
test_dog_init (TestDog * self) {
}
static void
test_dog_class_init (TestDogClass * klass) {
TestAnimalClass * animal_class = TEST_ANIMAL_CLASS (klass);
animal_class->make_sound = test_dog_real_make_sound;
animal_class->move = test_dog_real_move;
}
/******************************************************************************/
void
test_dog_real_make_sound (TestDog * self) {
g_print ("The dog says \"awoo!\" and \"Wa Wa Wa\"\n");
}
void
test_dog_real_move (TestDog * self, gint x, gint y) {
g_print ("The dog runs around a bit and randomly ends up at (%i, %i).\n", x, y);
}
|