#include <dog.h>
/* --------------------------------------------
Note: Dog is a subclass of Animal.
-------------------------------------------- */
main()
{
AnimalNewClass(0,0);
DogNewClass(0,0);
if (_somDescendedFrom (_Dog, _Animal))
somPrintf("Dog IS descended from Animal\n");
else
somPrintf("Dog is NOT descended from Animal\n");
if (_somDescendedFrom (_Animal, _Dog))
somPrintf("Animal IS descended from Dog\n");
else
somPrintf("Animal is NOT descended from Dog\n");
This program produces the following output:
Dog IS descended from Animal Animal is NOT descended from Dog