/* * Simple program exemplifying the usage of Animal class * and its sub-classes */ #include /* * The main program here, only need access to the public interfaces * but the sub-classes will need access to the animal's private interface */ #include "animal_p.h" #include "cat_p.h" int main(void) { /* We don't need to know how the cat object is implemented */ struct cat *myCat = cat_new(); cat_ctor(myCat); /* * For us to have the Animal class definition hidden, the animal_sound() * should have a way to defer the parent Animal class, from the cat class. * * See its implementation within animal.c */ animal_sound((struct animal *)myCat); return 0; }