32: {
33: public:
34:
35: // Constructors
36: Dog();
37: Dog(int age);
38: Dog(int age, int weight);
39: Dog(int age, BREED breed);
40: Dog(int age, int weight, BREED breed);
41: ~Dog();
42:
43: // Accessors
44: BREED GetBreed() const { return itsBreed; }
45: void SetBreed(BREED breed) { itsBreed = breed; }
46:
47: // Other methods
48: void WagTail() const { cout << “Tail wagging...\n”; }
49: void BegForFood() const { cout << “Begging for food...\n”; }
50:
51: private:
52: BREED itsBreed;
53: };
54:
55: Mammal::Mammal():
56: itsAge(1),
57: itsWeight(5)
58: {
59: cout << “Mammal constructor...” << endl;
60: }
61:
62: Mammal::Mammal(int age):
63: itsAge(age),
64: itsWeight(5)
65: {
66: cout << “Mammal(int) constructor...” << endl;
67: }
68:
69: Mammal::~Mammal()
70: {
71: cout << “Mammal destructor...” << endl;
72: }
73:
74: Dog::Dog():
75: Mammal(),
76: itsBreed(GOLDEN)
77: {
78: cout << “Dog constructor...” << endl;
79: }
80:
382 Day 12
LISTING12.4 continued