//dog.cpp #include //cout, endl using namespace std; #include "dog.h" //******** Dog Implementation ******* //constructors and destructor Dog::Dog():itsBreed(retriever) {cout << "Making a Dog\n";} Dog::~Dog(){cout << "Destroying a Dog.\n";} //accessors Breed Dog::GetBreed() {return itsBreed;} void Dog::SetBreed(Breed b) {itsBreed=b;} //other methods void Dog::WagTail(){cout << "Wag, wag, wag!\n";} void Dog::Speak() {cout << "Have pity on me! " << "Please feed a hungry dog.\n";} void Dog::Identify() //overrides virtual {cout << "I am a Dog.\n";} #define DOG_TEST #ifdef DOG_TEST int main() { Dog thelma; thelma.SetAge(11); thelma.SetBreed(husky); thelma.SetWeight(70); thelma.Sleep(); thelma.Speak(); thelma.WagTail(); thelma.Identify(); cout << "Thelma's statistics: " << thelma.GetAge() << ' ' << thelma.GetWeight() << endl; switch (thelma.GetBreed()){ case retriever: cout << "A reliable retriever."; break; case collie: cout << "A furry collie."; break; case husky: cout << "A husky from Alaska."; break; case mutt: cout << "A friendly mutt."; break; default: cout << "no breed!"; break; }//end switch cout << endl; return 0; } #endif