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
|
static void Chien_init(Chien);
Animal Chien_new(char* name)
{
chien* tthis = malloc(sizeof *tthis);
// on realise un test i sa echoue
Chien_init(tthis);
tthis->name = name;
return tthis->parent;
}
/*************************/
// c'est ici que les pointeurs de structure vont nous permettre de faire du polymorphisme
static void Chien_init(Chien tthis)
{
animal* parent = Animal_new();
parent->Crie = crie_de_chien;
parent->Set_child_name(parent,"Chien");
tthis->parent = parent;
parent->Set_child(parent,tthis);
}
/****************/
void crie_de_chien(Animal parent)
{
printf("\nAboie; woah woah Grrrrr!!!!\n");
} |