Preface</font><br>Acknowledgements</font><br>Introduction</font><br></font><br>Shifting From C to C++</font><br></font><br>Items 1:Prefer const and inline to #define</font><br>Items 2:Prefer iostream to stdio.h</font><br>Items 3:Prefer new and delete to malloc and free</font><br>Items 4:Prefer C++-style comments</font><br></font><br>Memory Management</font><br></font><br>Items 5:Use the same form in corresponding uses of new and delete</font><br>Items 6:Use delete on pointer members in destructors</font><br>Items 7:Be prepared for out-of-memory conditions</font><br>Items 8:Adhere to convention when writing operator new and operator delete</font><br>Items 9:Avoid hiding the "normal" form of new</font><br>Items 10:Write operator delete if you write operator new</font><br></font><br>Constructors, Destructors, and Assignment Operators</font><br></font><br>Items 11:Declare a copy constructor and an assignment operator for classes with dynamically allocated memory</font><br>Items 12:Prefer initialization to assignment in constructors</font><br>Items 13:List members in an initialization list in the order in which they are declared</font><br>Items 14:Make destructors virtual in base classes</font><br>Items 15:Have operator return a reference to *this</font><br>Items 16:Assign to all data members in operator</font><br>Items 17:Check for assignment to self in operator</font><br></font><br>Classes and Functions: Design and Declaration</font><br></font><br>Items 18:Strive for class interfaces that are complete and minimal</font><br>Items 19:Differentiate among member functions, non-member functions, and friend functions</font><br>Items 20:Avoid data members in the public interface</font><br>Items 21:Use const whenever possible</font><br>Items 22:Prefer pass-by-reference to pass-by-value</font><br>Items 23:Don't try to return a reference when you must return an object</font><br>Items 24:Choose carefully between function overloading and parameter defaulting</font><br>Items 25:Avoid overloading on a pointer and a numerical type</font><br>Items 26:Guard against potential ambiguity</font><br>Items 27:Explicitly disallow use of implicitly generated member functions you don't want</font><br>Items 28:Partition the global namespace</font><br></font><br>Classes and Functions: Implementation</font><br></font><br>Items 29:Avoid returning "handles" to internal data</font><br>Items 30:Avoid member functions that return non-const pointers or references to members less accessible than themselves</font><br>Items 31:Never return a reference to a local object or to a dereferenced pointer initialized by new within the function</font><br>Items 32:Postpone variable definitions as long as possible</font><br>Items 33:Use inlining judiciously</font><br>Items 34:Minimize compilation dependencies between files</font><br></font><br>Inheritance and Object-Oriented Design</font><br></font><br>Items 35:Make sure public inheritance models "isa." </font><br>Items 36:Differentiate between inheritance of interface and inheritance of implementation</font><br>Items 37:Never redefine an inherited nonvirtual function</font><br>Items 38:Never redefine an inherited default parameter value</font><br>Items 39:Avoid casts down the inheritance hierarchy</font><br>Items 40:Model "has-a" or "is-implemented-in-terms-of" through layering</font><br>Items 41:Differentiate between inheritance and templates</font><br>Items 42:Use private inheritance judiciously</font><br>Items 43:Use multiple inheritance judiciously</font><br>Items 44:Say what you mean; understand what you're saying</font><br></font><br>Miscellany</font><br></font><br>Items 45:Know what functions C++ silently writes and calls</font><br>Items 46:Prefer compile-time and link-time errors to runtime errors</font><br>Items 47:Ensure that non-local static objects are initialized before they're used</font><br>Items 48:Pay attention to compiler warnings</font><br>Items 49:Familiarize yourself with the standard library</font><br>Items 50:Improve your understanding of C++</font><br></font><br>Afterword</font><br>Index