// classes.cp -- cse143 assignment 5 sample solution, 2/99. HP // Implementation of crutter classes. #include #include #include "classes.h" // ----- Implementations of generic Critter operations. ----- // construct critter with description s Critter::Critter(const char *s) { strcpy(description, s); } // write critter description to cout void Critter::describe( ) const { cout << description; } // ----- Poodle implementation ----- // construct new poodle Poodle::Poodle( ): Critter("A poodle is a small dog with a funny haircut.") { } // write poodle noise to cout void Poodle::speak( ) const { cout << "Yap! Yap! Yap!"; } // ----- Bovine implementation ----- // construct new bovine with description s Bovine::Bovine(const char *s): Critter(s) { } // ----- Buffalo implementation ----- // construct new buffalo Buffalo::Buffalo( ): Bovine("A buffalo is a really large bovine that finds steady work in westerns.") { } // write buffalo noise to cout void Buffalo::speak( ) const { cout << "Wake me up when we get to the stampede scene."; } // ----- Cow implementation ----- // construct new cow Cow::Cow( ): Bovine("A cow is a large bovine that is in no particular hurry.") { } // write cow noise to cout void Cow::speak( ) const { cout << "Help! I've been tipped and I can't get up!"; }