Sams Teach Yourself C++ in 21 Days

(singke) #1
In Review 805

17: {
18: public:
19: void Speak() { cout << “Cat Speaks” << endl; }
20: };
21:
22: void DoIt(Animal*);
23:
24: int main()
25: {
26:
27: Animal * pA = new Dog;
28: DoIt(pA);
29: return 0;
30: }
31:
32: void DoIt(Animal * c)
33: {
34: cout << “They passed some kind of animal” << endl << endl;
35: c->Speak();
36: }

LISTINGR3.3 continued

28 0672327112_w3_wir.qxd 11/19/04 12:30 PM Page 805

Free download pdf