To C or Not to C (with Apologies to Shakespeare)

The sample code provided in this book is written mostly in C++, primarily because the concepts and features of OLE are best expressed in that language. Authoring a book of this sort presents a few philosophical difficulties, such as what language to use, how everything will fit on the companion disks, and how not to alienate those in your audience who do not understand C++.

C++ code is smaller and simplifies code reuse, reducing the amount of code I have to write and the amount of code you have to read. C programmers will no doubt be a little put off by this. The file APPA.WRI on the companion CD provides the necessary explanations of basic C++ concepts and notations that should help the C programmer understand the sample code. While writing the code, I tried to remember that it has to be understandable to a typical C programmer, so I've purposely kept myself from going hog-wild about everything C++ can do, such as deep multiple inheritance or long chains of virtual functions. This will no doubt put off a number of C++ programmers, but believe me, this is not as bad as forcing everyone to labor through verbose C.

For the most part, the samples are written using C++ as a better C, which is the most primitive way to use C++. This primarily means that C++ is a more convenient way to manage data structures and create OLE objects and interfaces. Some of the samples have, in fact, a C language legacy, and I have converted them to C++ mostly by switching structures into classes. I hope that those readers who are not very familiar with C++ will still be able to make sense of the samples.