Sams Teach Yourself C in 21 Days

(singke) #1
49:
50: cout << “\n. >> ...sub class instantiated...”;
51: cout << “\n. >> ...ending program...\n”;
52:
53: return 0;
54: }

. >> Instantiating a sub class...


B >> in base class constructor...
S >> in sub class constructor...

. >> ...sub class instantiated...
. >> ...ending program...
S >> ...in sub class destructor
B >> ...in base class destructor


698 Bonus Day 3

LISTINGB3.9 continued

OUTPUT

Review the output of Listing B3.9 and make sure you understand it.
Knowing the order in which code is executed can save you a lot of time
when trying to hunt down errors in code and code logic.

Tip


A Caution on What You’ve Learned About C++ ................................................


In the last couple of days, you have learned quite a bit about C++ and object-oriented
programming. You have, however, only just begun to scratch the surface of what is avail-
able in C++. There are a lot of features of C++ you haven’t covered, including, but not
limited to


  • multiple inheritance

  • templates

  • RTTI (Run-Time Type Information)

  • friend functions

  • nonpublic inheritance

  • overriding versus overloading

  • overloading operators
    Each of these features offers additional functionality to your C++ programs and can help
    to extend the capability to reuse your C++ code. Because each of these features help in


38 448201x-Bonus3 8/13/02 11:19 AM Page 698

Free download pdf