#ifndef _DOG_H_ #define _DOG_H_ typedef struct dog_st *Dog; // all dogs know how to delete themselves, bark, and // encode themselves as a string struct dog_vtable_st { void (*delete)(Dog d); void (*bark)(Dog d); char *(*toString)(Dog d); }; typedef struct dog_st { struct dog_vtable_st *vtable; char *name; int age; } *Dog; // separate allocation of dog from initialization Dog new_dog(char *name, int age); int _dog_constructor(Dog d, char *name, int age); void _delete(Dog d); void _bark(Dog d); #endif //_DOG_H_