462 Day 14
60: return itsNumberBelievers;
61: }
62:
63: private:
64: long itsNumberBelievers;
65: };
66:
67: Pegasus::Pegasus(
68: COLOR aColor,
69: HANDS height,
70: bool migrates,
71: long NumBelieve):
72: Horse(aColor, height),
73: Bird(aColor, migrates),
74: itsNumberBelievers(NumBelieve)
75: {
76: cout << “Pegasus constructor...\n”;
77: }
78:
79: int main()
80: {
81: Pegasus *pPeg = new Pegasus(Red, 5, true, 10);
82: pPeg->Fly();
83: pPeg->Whinny();
84: cout << “\nYour Pegasus is “ << pPeg->GetHeight();
85: cout << “ hands tall and “;
86: if (pPeg->GetMigration())
87: cout << “it does migrate.”;
88: else
89: cout << “it does not migrate.”;
90: cout << “\nA total of “ << pPeg->GetNumberBelievers();
91: cout << “ people believe it exists.” << endl;
92: delete pPeg;
93: return 0;
94: }
Horse constructor...
Bird constructor...
Pegasus constructor...
I can fly! I can fly! I can fly! Whinny!...
Your Pegasus is 5 hands tall and it does migrate.
A total of 10 people believe it exists.
Pegasus destructor...
Bird destructor...
Horse destructor...
OUTPUT
LISTING14.4 continued