| Acknowledgments |
|
xxxiii | |
| Part I Preliminaries |
|
1 | (60) |
|
|
|
3 | (8) |
|
FAQ 1.01: What is the purpose of this chapter? |
|
|
3 | (1) |
|
FAQ 1.02: What are C++ FAQs? |
|
|
3 | (1) |
|
FAQ 1.03: Who is the target audience for this book? |
|
|
4 | (1) |
|
FAQ 1.04: Is this a book about C++ per se? |
|
|
4 | (1) |
|
FAQ 1.05: Why do developers need a guidebook for C++ and OO technology? |
|
|
5 | (1) |
|
FAQ 1.06: What kind of guidance is given in the answers to these FAQs? |
|
|
5 | (1) |
|
FAQ 1.07: What is the electronic FAQ and why buy this book when the electronic FAQ is free? |
|
|
6 | (1) |
|
FAQ 1.08: Why should you buy this edition if you already have a copy of the first edition? |
|
|
7 | (1) |
|
FAQ 1.09: What conventions are used in this book? |
|
|
7 | (4) |
|
Chapter 2 Basic C++ Syntax and Semantics |
|
|
11 | (32) |
|
FAQ 2.01: What is the purpose of this chapter? |
|
|
11 | (1) |
|
FAQ 2.02: What are the basics of main ()? |
|
|
11 | (1) |
|
FAQ 2.03: What are the basics of functions? |
|
|
12 | (1) |
|
FAQ 2.04: What are the basics of default parameters? |
|
|
13 | (1) |
|
FAQ 2.05: What are the basics of local (auto) objects? |
|
|
13 | (2) |
|
FAQ 2.06: What are the basics of constructing objects using explicit parameters? |
|
|
15 | (1) |
|
FAQ 2.07: What are the basics of dynamically allocated (new) objects? |
|
|
16 | (1) |
|
FAQ 2.08: What are the basics of local objects within inner scopes? |
|
|
17 | (1) |
|
FAQ 2.09: What are the basics of passing objects by reference? |
|
|
18 | (1) |
|
FAQ 2.10: What are the basics of passing objects by value? |
|
|
19 | (1) |
|
FAQ 2.11: What are the basics of passing objects by pointer? |
|
|
20 | (1) |
|
FAQ 2.12: What are the basics of stream output? |
|
|
21 | (1) |
|
FAQ 2.13: What are the basics of stream input? |
|
|
22 | (2) |
|
FAQ 2.14: What are the basics of using classes that contain overloaded operators? |
|
|
24 | (1) |
|
FAQ 2.15: What are the basics of using container classes? |
|
|
24 | (2) |
|
FAQ 2.16: What are the basics of creating class header files? |
|
|
26 | (1) |
|
FAQ 2.17: What are the basics of defining a class? |
|
|
27 | (1) |
|
FAQ 2.18: What are the basics of defining member functions? |
|
|
28 | (1) |
|
FAQ 2.19: What are the basics of adding a constructor to a class? |
|
|
29 | (2) |
|
FAQ 2.20: What are the basics of adding a destructor to a class? |
|
|
31 | (1) |
|
FAQ 2.21: What are the basics of defining a class that contains a pointer to an object allocated from the heap? |
|
|
32 | (3) |
|
FAQ 2.22: What are the basics of global objects? |
|
|
35 | (2) |
|
FAQ 2.23: What are the basics of throwing and catching exceptions? |
|
|
37 | (2) |
|
FAQ 2.24: What are the basics of inheritance and dynamic binding? |
|
|
39 | (4) |
|
Chapter 3 Understanding the Management Perspective |
|
|
43 | (8) |
|
FAQ 3.01: What is the purpose of this chapter? |
|
|
43 | (1) |
|
FAQ 3.02: What is the core message of this chapter (and this book)? |
|
|
44 | (1) |
|
FAQ 3.03: Why are the managers in charge rather than the developers who understand technology? |
|
|
45 | (1) |
|
FAQ 3.04: How can someone manage something they don't understand? |
|
|
45 | (1) |
|
FAQ 3.05: What is the most common mistake on C++ and OO projects? |
|
|
46 | (1) |
|
FAQ 3.06: What's the "Software Peter Principle"? |
|
|
47 | (1) |
|
FAQ 3.07: Should an organization use OO on all its projects? |
|
|
47 | (1) |
|
FAQ 3.08: Can OO be ignored until it goes away? |
|
|
48 | (1) |
|
FAQ 3.09: What OO language is best? |
|
|
48 | (1) |
|
FAQ 3.10: What is the right approach to processes and tools? |
|
|
49 | (1) |
|
FAQ 3.11: What is the right approach with off-the-shelf class libraries and frameworks? |
|
|
50 | (1) |
|
Chapter 4 The Architectural Perspective |
|
|
51 | (10) |
|
FAQ 4.01: What is the purpose of this chapter? |
|
|
51 | (1) |
|
FAQ 4.02: Why is software architecture important? |
|
|
52 | (1) |
|
FAQ 4.03: What should the architecture be based on, the problem being solved or the problem domain? |
|
|
53 | (1) |
|
FAQ 4.04: Should the software architecture be based on the policy of the problem? |
|
|
53 | (1) |
|
FAQ 4.05: Do customers ever change their requirements? |
|
|
54 | (1) |
|
FAQ 4.06: Are stable requirements desirable? |
|
|
54 | (1) |
|
FAQ 4.07: What is the key to planning for change? |
|
|
55 | (1) |
|
FAQ 4.08: What is a framework? |
|
|
55 | (1) |
|
FAQ 4.09: What is the "inversion of control" exhibited by frameworks? |
|
|
56 | (1) |
|
FAQ 4.10: What is an extensible, domain-specific framework? |
|
|
56 | (1) |
|
FAQ 4.11: What characterstics make a framework extensible yet domain-specific? |
|
|
57 | (1) |
|
FAQ 4.12: What happens if the domain analysis is incorrect? |
|
|
58 | (1) |
|
FAQ 4.13: How much effort should be expended to support change--that is, how much is extensibility worth? |
|
|
58 | (1) |
|
FAQ 4.14: How does an architect make the software architecture flexible? |
|
|
59 | (1) |
|
FAQ 4.15: What is the secret to achieving reuse? |
|
|
59 | (2) |
| Part II Object-Oriented Design |
|
61 | (92) |
|
Chapter 5 Object-Oriented Fundamentals |
|
|
63 | (20) |
|
FAQ 5.01: What is the purpose of this chapter? |
|
|
63 | (1) |
|
FAQ 5.02: Why is the world adopting OO technology? |
|
|
63 | (1) |
|
FAQ 5.03: What are some of the benefits of using C++ for OO programming? |
|
|
64 | (1) |
|
FAQ 5.04: What are the fundamental concepts of object-oriented technology? |
|
|
65 | (1) |
|
FAQ 5.05: Why are classes important? |
|
|
66 | (1) |
|
FAQ 5.06: What is an object? |
|
|
66 | (1) |
|
FAQ 5.07: What are the desirable qualities of an object? |
|
|
67 | (1) |
|
FAQ 5.08: How are classes better than the three basic building blocks of procedural software? |
|
|
68 | (1) |
|
FAQ 5.09: What is the purpose of composition? |
|
|
69 | (1) |
|
FAQ 5.10: What is the purpose of inheritance? |
|
|
70 | (1) |
|
FAQ 5.11: What are the advantages of polymorphism and dynamic binding? |
|
|
71 | (1) |
|
FAQ 5.12: How does OO help produce flexible and extensible software? |
|
|
71 | (1) |
|
FAQ 5.13: How can old code call new code? |
|
|
72 | (3) |
|
FAQ 5.14: What is an abstraction and why is it important? |
|
|
75 | (1) |
|
FAQ 5.15: Should abstractions be user-centric or developer-centric? |
|
|
75 | (1) |
|
FAQ 5.16: What's the difference between encapsulation and abstraction? |
|
|
76 | (1) |
|
FAQ 5.17: What are the consequences of encapsulating a bad abstraction? |
|
|
76 | (1) |
|
FAQ 5.18: What's the value of separating interface from implementation? |
|
|
77 | (1) |
|
FAQ 5.19: How can separating interface from implementation improve performance as well as flexibility? |
|
|
78 | (1) |
|
FAQ 5.20: What is the best way to create a good interface to an abstraction? |
|
|
79 | (1) |
|
FAQ 5.21: How are get/set member functions related to poorly designed interfaces? |
|
|
80 | (1) |
|
FAQ 5.22: Should there be a get and a set member function for each member datum? |
|
|
80 | (1) |
|
FAQ 5.23: Is the real purpose of a class to export data? |
|
|
81 | (1) |
|
FAQ 5.24: Should OO be viewed as data-centric? |
|
|
81 | (2) |
|
Chapter 6 Specification of Observable Behavior |
|
|
83 | (12) |
|
FAQ 6.01: What is the purpose of this chapter? |
|
|
83 | (1) |
|
FAQ 6.02: Should users of a member function rely on what the code actually does or on the specification? |
|
|
84 | (1) |
|
FAQ 6.03: What are the advantages of relying on the specification rather than the implementation? |
|
|
85 | (1) |
|
FAQ 6.04: What are the advertised requirements and advertised promises? |
|
|
86 | (1) |
|
FAQ 6.05: How are the advertised requirements and advertised promise of the member functions specified? |
|
|
87 | (2) |
|
FAQ 6.06: Why are changes feared in development organizations that don't use specification? |
|
|
89 | (1) |
|
FAQ 6.07: How do developers determine if a proposed change will break existing code? |
|
|
90 | (1) |
|
FAQ 6.08: What are the properties of a substitutable (backward compatible) change in a specification? |
|
|
90 | (1) |
|
FAQ 6.09: How can it be shown that the implementation of a member function fulfills its specification? |
|
|
91 | (1) |
|
FAQ 6.10: Is it possible to keep the specification synchronized with the code? |
|
|
92 | (3) |
|
Chapter 7 Proper Inheritance |
|
|
95 | (8) |
|
FAQ 7.01: What is proper inheritance? |
|
|
95 | (2) |
|
FAQ 7.02: What are the benefits of proper inheritance? |
|
|
97 | (1) |
|
FAQ 7.03: What is improper inheritance? |
|
|
97 | (1) |
|
FAQ 7.04: Isn't the difference between proper and improper inheritance obvious? |
|
|
98 | (1) |
|
FAQ 7.05: Is substitutability based on what the code does or what the specification promises the code will do? |
|
|
99 | (1) |
|
FAQ 7.06: Is it proper to revoke (hide) an inherited public: member function? |
|
|
100 | (1) |
|
FAQ 7.07: What is specialization? |
|
|
101 | (1) |
|
FAQ 7.08: What do subsets have to do with proper inheritance? |
|
|
102 | (1) |
|
Chapter 8 Detecting and Correcting Improper Inheritance |
|
|
103 | (26) |
|
FAQ 8.01: Can improper inheritance wreck a project? |
|
|
103 | (1) |
|
FAQ 8.02: What's the best way to learn how to avoid improper inheritance? |
|
|
104 | (1) |
|
FAQ 8.03: Is intuition a reliable guide to understanding proper inheritance? |
|
|
104 | (1) |
|
FAQ 8.04: Is an Ostrich a kind-of Bird? |
|
|
104 | (2) |
|
FAQ 8.05: Should an overridden virtual function throw an exception? |
|
|
106 | (3) |
|
FAQ 8.06: Can an overridden virtual function be a no-op? |
|
|
109 | (2) |
|
FAQ 8.07: Why does C++ make it so hard to fix the Ostrich/Bird dilemma? |
|
|
111 | (1) |
|
FAQ 8.08: Should Circle inherit from Ellipse? |
|
|
111 | (2) |
|
FAQ 8.09: What can be done about the asymmetric-circle dilemma? |
|
|
113 | (2) |
|
FAQ 8.10: What is the one issue in these FAQs that doesn't seem to die? |
|
|
115 | (1) |
|
FAQ 8.11: Should Stack inherit from List? |
|
|
115 | (2) |
|
FAQ 8.12: Is code reuse the main purpose of inheritance? |
|
|
117 | (2) |
|
FAQ 8.13: Is container-of-thing a kind-of container-of-anything? |
|
|
119 | (1) |
|
FAQ 8.14: Is bag-of-apple a kind-of bag-of-fruit, assuming bag-of-fruit allows the insertion of any kind-of-fruit? |
|
|
119 | (4) |
|
FAQ 8.15: Is parking-lot-for-cars a kind-of parking-lot-for-arbitrary-vehicles (assuming parking-lot-for-vehicles allows parking any kind-of vehicle)? |
|
|
123 | (1) |
|
FAQ 8.16: Is array-of Derived a kind-of array-of Base? |
|
|
124 | (2) |
|
FAQ 8.17: Does the fact that an array-of Derived can be passed as an array-of Base mean that arrays are bad? |
|
|
126 | (3) |
|
Chapter 9 Error Handling Strategies |
|
|
129 | (14) |
|
FAQ 9.01: Is error handling a major source of fundamental mistakes? |
|
|
129 | (1) |
|
FAQ 9.02: How should runtime errors be handled in C++? |
|
|
130 | (1) |
|
FAQ 9.03: What happens to objects in stack frames that become unwound during the throw/catch process? |
|
|
131 | (1) |
|
FAQ 9.04: What is an exception specification? |
|
|
131 | (1) |
|
FAQ 9.05: What are the disadvantages of using return codes for error handling? |
|
|
132 | (1) |
|
FAQ 9.06: What are the advantages of throw...catch? |
|
|
132 | (1) |
|
FAQ 9.07: Why is it helpful to separate normal logic from exception handling logic? |
|
|
133 | (3) |
|
FAQ 9.08: What is the hardest part of using exception handling? |
|
|
136 | (1) |
|
FAQ 9.09: When should a function throw an exception? |
|
|
137 | (3) |
|
FAQ 9.10: What is the best approach for the hierachy of exception objects? |
|
|
140 | (1) |
|
FAQ 9.11: How should exception classes be named? |
|
|
141 | (1) |
|
FAQ 9.12: Where do set jmp and longjmp belong in C++? |
|
|
141 | (2) |
|
Chapter 10 Testing Strategies |
|
|
143 | (10) |
|
FAQ 10.01: What is the purpose of this chapter? |
|
|
143 | (1) |
|
FAQ 10.02: What are the advantages of self-testing objects? |
|
|
143 | (1) |
|
FAQ 10.03: What are some common excuses people use for not building self-testing into their objects? |
|
|
144 | (1) |
|
FAQ 10.04: What will happen if techniques like those presented here are not used? |
|
|
145 | (1) |
|
FAQ 10.05: When is a class correct? |
|
|
146 | (1) |
|
FAQ 10.06: What is behavioral self-testing? |
|
|
146 | (3) |
|
FAQ 10.07: What is a class invariant? |
|
|
149 | (1) |
|
FAQ 10.08: Why should the invariant be captured explicitly? |
|
|
149 | (1) |
|
FAQ 10.09: When should the testInvariant () member function be called? |
|
|
150 | (1) |
|
FAQ 10.10: What can be done to ensure that an object doesn't get blown away by a wild pointer? |
|
|
151 | (2) |
| Part III Language Facilities |
|
153 | (248) |
|
|
|
155 | (10) |
|
FAQ 11.01: What is a reference? |
|
|
155 | (1) |
|
FAQ 11.02: What does "referent" mean? |
|
|
156 | (1) |
|
FAQ 11.03: When can a reference be attached to its referent? |
|
|
156 | (1) |
|
FAQ 11.04: What happens when a value is assigned to a reference? |
|
|
157 | (1) |
|
FAQ 11.05: What is a local reference? |
|
|
157 | (1) |
|
FAQ 11.06: What does it mean to return a reference? |
|
|
158 | (1) |
|
FAQ 11.07: What is the result of taking the address of a reference? |
|
|
159 | (1) |
|
FAQ 11.08: Can a reference be made to refer to a different referent? |
|
|
160 | (1) |
|
FAQ 11.09: Why use references when pointers can do everything references can do? |
|
|
160 | (1) |
|
FAQ 11.10: Aren't references just pointers in disguise? |
|
|
161 | (1) |
|
FAQ 11.11: When are pointers needed? |
|
|
161 | (1) |
|
FAQ 11.12: Why do some people hate references? |
|
|
162 | (1) |
|
FAQ 11.13: Does int& const x make sense? |
|
|
163 | (2) |
|
Chapter 12 New and Delete |
|
|
165 | (18) |
|
FAQ 12.01: Does new do more than allocate memory? |
|
|
165 | (1) |
|
FAQ 12.02: Why is new better than good old trustworthy malloc ()? |
|
|
165 | (1) |
|
FAQ 12.03: Does C++ have a counterpart to realloc () that goes along with new and delete? |
|
|
166 | (1) |
|
FAQ 12.04: Can pointers returned from new be deallocated with free ()? Can pointers returned from malloc () be deallocated with delete? |
|
|
166 | (1) |
|
FAQ 12.05: Does delete p delete the pointer p or the referent *p? |
|
|
167 | (1) |
|
FAQ 12.06: Should the pointer returned from new Fred () be checked to see if it is NULL? |
|
|
167 | (1) |
|
FAQ 12.07: How can new be convinced to return NULL rather than throw an exception? |
|
|
168 | (1) |
|
FAQ 12.08: How can new be set up to automatically flush pools of recycled objects whenever memory runs low? |
|
|
169 | (3) |
|
FAQ 12.09: What happens if delete p is called when p is NULL? |
|
|
172 | (1) |
|
FAQ 12.10: What happens when a pointer is deleted twice? |
|
|
172 | (1) |
|
FAQ 12.11: How can an array of things be allocated and deallocated? |
|
|
173 | (1) |
|
FAQ 12.12: What is delete p (not delete [] p) is used to delete an array allocated via new Fred [n]? |
|
|
174 | (1) |
|
FAQ 12.13: Can the [] of delete [] p be dropped when p points to an array of some built-in type such as char? |
|
|
174 | (1) |
|
FAQ 12.14: How is an object constructed at a predetermined position in memory? |
|
|
175 | (1) |
|
FAQ 12.15: How can class Fred guarantee that Fred objects are created only with new and not on the stack? |
|
|
176 | (1) |
|
FAQ 12.16: How are objects created by placement new destroyed? |
|
|
177 | (1) |
|
FAQ 12.17: In p = new Fred (), does the Fred memory "leak" if the Fred constructor throws an exception? |
|
|
178 | (1) |
|
FAQ 12.18: Is it legal (and moral) for a member function to say delete this? |
|
|
179 | (1) |
|
FAQ 12.19: After p = new Fred [n], how does the compiler know that there are n objects to be destructed during delete [] p? |
|
|
180 | (3) |
|
Chapter 13 Inline Functions |
|
|
183 | (10) |
|
FAQ 13.01: What is the purpose of inline functions? |
|
|
183 | (1) |
|
FAQ 13.02: What is the connection between the keyword "inline" and "inlined" functions? |
|
|
184 | (1) |
|
FAQ 13.03: Are there any special rules about inlining? |
|
|
184 | (1) |
|
FAQ 13.04: What is the one-definition rule (ODR)? |
|
|
185 | (1) |
|
FAQ 13.05: What are some performance considerations with inline functions? |
|
|
185 | (1) |
|
FAQ 13.06: Do inlined functions improve performance? |
|
|
186 | (1) |
|
FAQ 13.07: Do inlined functions increase the size of the executable code? |
|
|
187 | (1) |
|
FAQ 13.08: Why shouldn't the inlining decision be made when the code is first written? |
|
|
188 | (1) |
|
FAQ 13.09: What happens when a programmer uses an inlined function obtained from a third party? |
|
|
189 | (1) |
|
FAQ 13.10: Is there an easy way to swap between inline and non-inline code? |
|
|
190 | (3) |
|
Chapter 14 Const Correctness |
|
|
193 | (14) |
|
FAQ 14.01: How should pointer declarations be read? |
|
|
193 | (1) |
|
FAQ 14.02: How can C++ programmers avoid making unexpected changes to objects? |
|
|
194 | (1) |
|
FAQ 14.03: Does const imply runtime overhead? |
|
|
195 | (1) |
|
FAQ 14.04: Does const allow the compiler to generate more efficient code? |
|
|
195 | (1) |
|
FAQ 14.05: Is const correctness tedious? |
|
|
196 | (1) |
|
FAQ 14.06: Why should const correctness be done sooner rather than later? |
|
|
196 | (1) |
|
FAQ 14.07: What's the difference between an inspector and a mutator? |
|
|
197 | (1) |
|
FAQ 14.08: When should a member function be declared as const? |
|
|
198 | (1) |
|
FAQ 14.09: Does const apply to the object's bitwise state or its abstract state? |
|
|
199 | (1) |
|
FAQ 14.10: When should const not be used in declaring formal parameters? |
|
|
200 | (1) |
|
FAQ 14.11: When should const not be used in declaring a function return type? |
|
|
201 | (1) |
|
FAQ 14.12: How can a "nonobservable" data member be updated within a const member function? |
|
|
202 | (1) |
|
FAQ 14.13: Can an object legally be changed even though there is a const reference (pointer) to it? |
|
|
203 | (1) |
|
FAQ 14.14: Does const_cast mean lost optimization opportunities? |
|
|
204 | (3) |
|
|
|
207 | (10) |
|
FAQ 15.01: What is the purpose of this chapter? |
|
|
207 | (1) |
|
FAQ 15.02: What is a namespace? |
|
|
208 | (1) |
|
FAQ 15.03: How can code outside a namespace use names declared within that namespace? |
|
|
209 | (1) |
|
FAQ 15.04: What happens if two namespaces contain the same name? |
|
|
210 | (1) |
|
FAQ 15.05: What are some of the rules for using namespaces? |
|
|
211 | (1) |
|
FAQ 15.06: What is name lookup? |
|
|
212 | (1) |
|
FAQ 15.07: What are the tradeoffs between the various techniques for using names from a namespace, particularly the standard namespace? |
|
|
213 | (1) |
|
FAQ 15.08: Can namespaces break code? |
|
|
213 | (2) |
|
FAQ 15.09: Do namespaces have any other applications? |
|
|
215 | (1) |
|
FAQ 15.10: How do namespaces solve the problem of long identifiers? |
|
|
215 | (2) |
|
|
|
217 | (22) |
|
FAQ 16.01: What is the purpose of this chapter? |
|
|
217 | (1) |
|
FAQ 16.02: What are static class members? |
|
|
217 | (1) |
|
FAQ 16.03: What is an analogy for static data members? |
|
|
218 | (2) |
|
FAQ 16.04: Can inline functions safely access static data members? |
|
|
220 | (2) |
|
FAQ 16.05: What is an analogy for static member functions? |
|
|
222 | (2) |
|
FAQ 16.06: How is a static data member similar to a global variable? |
|
|
224 | (1) |
|
FAQ 16.07: How is a static member function similar to a friend function? |
|
|
224 | (1) |
|
FAQ 16.08: What is the named constructor idiom? |
|
|
225 | (1) |
|
FAQ 16.09: How should static member functions be called? |
|
|
226 | (1) |
|
FAQ 16.10: Why might a class with static data members get linker errors? |
|
|
227 | (1) |
|
FAQ 16.11: How is a const static data member initialized? |
|
|
227 | (2) |
|
FAQ 16.12: What is the right strategy for implementing a function that needs to maintain state between calls? |
|
|
229 | (1) |
|
FAQ 16.13: How can the function call operator help with functionoids? |
|
|
230 | (1) |
|
FAQ 16.14: Is it safe to be ignorant of the static initialization order problem? |
|
|
231 | (2) |
|
FAQ 16.15: What is a simple and robust solution to the static initialization order problem? |
|
|
233 | (1) |
|
FAQ 16.16: What if the static object's destructor has important side effects that must eventually occur? |
|
|
234 | (1) |
|
FAQ 16.17: What if the static object's destructor has important side effects that must eventually occur and the static object must be accessed by another static object's destructor? |
|
|
235 | (2) |
|
FAQ 16.18: What are some criteria for choosing between all these various techniques? |
|
|
237 | (2) |
|
Chapter 17 Derived Classes |
|
|
239 | (10) |
|
FAQ 17.01: What is the purpose of this chapter? |
|
|
239 | (1) |
|
FAQ 17.02: How does C++ express inheritance? |
|
|
239 | (2) |
|
FAQ 17.03: What is a concrete derived class? |
|
|
241 | (1) |
|
FAQ 17.04: Why can't a derived class access the private: members of its base class? |
|
|
242 | (1) |
|
FAQ 17.05: How can a base class protect derived classes so that changes to the base class will not affect them? |
|
|
243 | (2) |
|
FAQ 17.06: Can a derived class pointer be converted into a pointer to its public base class? |
|
|
245 | (1) |
|
FAQ 17.07: How can a class Y be a kind-of another class X as well as getting the bits of X? |
|
|
245 | (1) |
|
FAQ 17.08: How can a class Y get the bits of an existing class X without making Y a kind-of X? |
|
|
246 | (1) |
|
FAQ 17.09: How can a class Y be a kind-of another class X without inheriting the bits of X? |
|
|
247 | (2) |
|
Chapter 18 Access Control |
|
|
249 | (4) |
|
FAQ 18.01: What is the purpose of this chapter? |
|
|
249 | (1) |
|
FAQ 18.02: How are private:, protected:, and public: different? |
|
|
249 | (1) |
|
FAQ 18.03: Why can't subclasses access the private: parts of their base class? |
|
|
250 | (1) |
|
FAQ 18.04: What's the difference between the keywords struct and class? |
|
|
250 | (1) |
|
FAQ 18.05: When should a data member be protected: rather than private:? |
|
|
251 | (1) |
|
FAQ 18.06: Why is private: the default access level for a class? |
|
|
251 | (2) |
|
Chapter 19 Friend Classes and Friend Functions |
|
|
253 | (16) |
|
FAQ 19.01: What is a friend? |
|
|
253 | (2) |
|
FAQ 19.02: What's a good mental model for friend classes? |
|
|
255 | (1) |
|
FAQ 19.03: What are some advantages of using friend classes? |
|
|
255 | (1) |
|
FAQ 19.04: Do friends violate the encapsulation barrier? |
|
|
256 | (1) |
|
FAQ 19.05: What is a friend function? |
|
|
256 | (1) |
|
FAQ 19.06: When should a function be implemented as a friend function rather than a member function? |
|
|
257 | (1) |
|
FAQ 19.07: What are some guidelines to make sure friend functions are used properly? |
|
|
258 | (1) |
|
FAQ 19.08: What does it mean that friendship isn't transitive? |
|
|
258 | (2) |
|
FAQ 19.09: What does it mean that friendship isn't inherited? |
|
|
260 | (1) |
|
FAQ 19.10: What does it mean that friends aren't virtual? |
|
|
261 | (2) |
|
FAQ 19.11: What qualities suggest a friend function rather than a member function? |
|
|
263 | (2) |
|
FAQ 19.12: Should friend functions be declared in the private:, protected:, or public: section of a class? |
|
|
265 | (1) |
|
FAQ 19.13: What is a private class? |
|
|
266 | (1) |
|
FAQ 19.14: How are objects of a class printed? |
|
|
267 | (1) |
|
FAQ 19.15: How do objects of a class receive stream input? |
|
|
268 | (1) |
|
Chapter 20 Constructors and Destructors |
|
|
269 | (18) |
|
FAQ 20.01: What is the purpose of a constructor? |
|
|
269 | (1) |
|
FAQ 20.02: What is C++'s constructor discipline? |
|
|
270 | (1) |
|
FAQ 20.03: What is the purpose of a destructor? |
|
|
271 | (1) |
|
FAQ 20.04: What is C++'s destructor discipline? |
|
|
271 | (1) |
|
FAQ 20.05: What happens when a destructor is executed? |
|
|
272 | (1) |
|
FAQ 20.06: What is the purpose of a copy constructor? |
|
|
273 | (1) |
|
FAQ 20.07: When is a copy constructor invoked? |
|
|
274 | (1) |
|
FAQ 20.08: What is the "default constructor"? |
|
|
275 | (2) |
|
FAQ 20.09: Should one constructor call another constructor as a primitive? |
|
|
277 | (1) |
|
FAQ 20.10: Does the destructor for a derived class need to explicitly call the destructor of its base class? |
|
|
278 | (1) |
|
FAQ 20.11: How can a local object be destructed before the end of its function? |
|
|
278 | (3) |
|
FAQ 20.12: What is a good way to provide intuitive, multiple constructors for a class? |
|
|
281 | (2) |
|
FAQ 20.13: When the constructor of a base class calls a virtual function, why isn't the override called? |
|
|
283 | (2) |
|
FAQ 20.14: When a base class destructor calls a virtual function, why isn't the override called? |
|
|
285 | (1) |
|
FAQ 20.15: What is the purpose of placement new? |
|
|
285 | (2) |
|
Chapter 21 Virtual Functions |
|
|
287 | (14) |
|
FAQ 21.01: What is the purpose of this chapter? |
|
|
287 | (1) |
|
FAQ 21.02: What is a virtual member function? |
|
|
287 | (1) |
|
FAQ 21.03: How much does it cost to call a virtual function compared to calling a normal function? |
|
|
288 | (1) |
|
FAQ 21.04: How does C++ perform static typing while supporting dynamic binding? |
|
|
288 | (1) |
|
FAQ 21.05: Can destructors be virtual? |
|
|
289 | (1) |
|
FAQ 21.06: What is the purpose of a virtual destructor? |
|
|
289 | (2) |
|
FAQ 21.07: What is a virtual constructor? |
|
|
291 | (2) |
|
FAQ 21.08: What syntax should be used when a constructor or destructor calls a virtual function in its object? |
|
|
293 | (2) |
|
FAQ 21.09: Should the scope operator: : be used when invoking virtual member functions? |
|
|
295 | (1) |
|
FAQ 21.10: What is a pure virtual member function? |
|
|
295 | (1) |
|
FAQ 21.11: Can a pure virtual function be defined in the same class that declares it? |
|
|
296 | (1) |
|
FAQ 21.12: How should a virtual destructor be defined when it has no code? |
|
|
297 | (1) |
|
FAQ 21.13: Can an ABC have a pure virtual destructor? |
|
|
298 | (1) |
|
FAQ 21.14: How can the compiler be kept from generating duplicate out-lined copies of inline virtual functions? |
|
|
299 | (1) |
|
FAQ 21.15: Should a class with virtual functions have at least one non-inline virtual function? |
|
|
299 | (2) |
|
Chapter 22 Initialization Lists |
|
|
301 | (14) |
|
FAQ 22.01: What are constructor initialization lists? |
|
|
301 | (1) |
|
FAQ 22.02: What will happen if constructor initialization lists are not used? |
|
|
302 | (1) |
|
FAQ 22.03: What's the guideline for using initialization lists in constructor definitions? |
|
|
303 | (1) |
|
FAQ 22.04: Is it normal for constructors to have nothing inside their body? |
|
|
303 | (2) |
|
FAQ 22.05: How is a const data member initialized? |
|
|
305 | (1) |
|
FAQ 22.06: How is a reference data member initialized? |
|
|
306 | (1) |
|
FAQ 22.07: Are initializers executed in the same order in which they appear in the initialization list? |
|
|
306 | (2) |
|
FAQ 22.08: How should initializers be ordered in a constructor's initialization list? |
|
|
308 | (1) |
|
FAQ 22.09: Is it moral for one member object to be initialized using another member object in the constructor's initialization list? |
|
|
309 | (2) |
|
FAQ 22.10: What if one member object has to be initialized using another member object? |
|
|
311 | (1) |
|
FAQ 22.11: Are there exceptions to the rule "Initialize all member objects in an initialization list"? |
|
|
312 | (1) |
|
FAQ 22.12: How can an array of objects be initialized with specific initializers? |
|
|
313 | (2) |
|
Chapter 23 Operator Overloading |
|
|
315 | (12) |
|
FAQ 23.01: Are overloaded operators like normal functions? |
|
|
315 | (1) |
|
FAQ 23.02: When should operator overloading be used? |
|
|
316 | (1) |
|
FAQ 23.03: What operators can't be overloaded? |
|
|
317 | (1) |
|
FAQ 23.04: Is the goal of operator overloading to make the class easier to understand? |
|
|
318 | (1) |
|
FAQ 23.05: Why do subscript operators usually come in pairs? |
|
|
319 | (1) |
|
FAQ 23.06: What is the most important consideration for operators such as +=, +, and =? |
|
|
320 | (1) |
|
FAQ 23.07: How are the prefix and postfix versions of operator ++ distinguished? |
|
|
321 | (1) |
|
FAQ 23.08: What should the prefix and postfix versions of operator ++ return? |
|
|
322 | (1) |
|
FAQ 23.09: How can a Matrix-like class have a subscript operator that takes more than one subscript? |
|
|
323 | (2) |
|
FAQ 23.10: Can a** operator serve as an exponentiation operator? |
|
|
325 | (2) |
|
Chapter 24 Assignment Operators |
|
|
327 | (16) |
|
FAQ 24.01: What should assignment operators return? |
|
|
327 | (1) |
|
FAQ 24.02: What is wrong with an object being assigned to itself? |
|
|
328 | (1) |
|
FAQ 24.03: What should be done about self-assignment? |
|
|
329 | (1) |
|
FAQ 24.04: Should an assignment operator throw an exception after partially assigning an object? |
|
|
330 | (2) |
|
FAQ 24.05: How should the assignment operator be declared in an ABC? |
|
|
332 | (2) |
|
FAQ 24.06: When should a user-defined assignment operator mimic the assignment operator that the compiler would generate automatically? |
|
|
334 | (1) |
|
FAQ 24.07: What should be returned by private: and protected: assignment operators? |
|
|
334 | (1) |
|
FAQ 24.08: Are there techniques that increase the likelihood that the compiler-synthesized assignment operator will be right? |
|
|
335 | (1) |
|
FAQ 24.09: How should the assignment operator in a derived class behave? |
|
|
335 | (2) |
|
FAQ 24.10: Can an ABC's assignment operator be virtual? |
|
|
337 | (2) |
|
FAQ 24.11: What should a derived class do a base class's assignment operator is virtual? |
|
|
339 | (2) |
|
FAQ 24.12: Should the assignment operator be implemented by using placement new and the copy constructor? |
|
|
341 | (2) |
|
|
|
343 | (10) |
|
FAQ 25.01: What is the purpose of templates? |
|
|
343 | (1) |
|
FAQ 25.02: What are the syntax and semantics for a class template? |
|
|
344 | (2) |
|
FAQ 25.03: How can a template class be specialized to handle special cases? |
|
|
346 | (2) |
|
FAQ 25.04: What are the syntax and semantics for a function template? |
|
|
348 | (1) |
|
FAQ 25.05: Should a template use memcpy () to copy objects of its template argument? |
|
|
349 | (2) |
|
FAQ 25.06: Why does the compiler complain about ]] when one template is used inside another? |
|
|
351 | (2) |
|
Chapter 26 Exception Tactics |
|
|
353 | (14) |
|
FAQ 26.01: What belongs in a try block? |
|
|
353 | (1) |
|
FAQ 26.02: When should a function catch an exception? |
|
|
353 | (1) |
|
FAQ 26.03: Should a catch block fully recover from an error? |
|
|
354 | (2) |
|
FAQ 26.04: How should a constructor handle a failure? |
|
|
356 | (1) |
|
FAQ 26.05: What are zombie objects (and why should they be avoided)? |
|
|
357 | (1) |
|
FAQ 26.06: What should an object do if one of its member objects could throw an exception during its constructor? |
|
|
357 | (2) |
|
FAQ 26.07: Should destructors throw exceptions when they fail? |
|
|
359 | (1) |
|
FAQ 26.08: Should destructors call routines that may throw exceptions? |
|
|
359 | (2) |
|
FAQ 26.09: Should resource deallocation primitives signal failure by throwing an exception? |
|
|
361 | (1) |
|
FAQ 26.10: What should the terminate () function do? |
|
|
361 | (1) |
|
FAQ 26.11: What should the unexpected () function do? |
|
|
361 | (2) |
|
FAQ 26.12: Under what circumstances can an overridden virtual member function throw exceptions other than those listed by the specification of the member function in the base class? |
|
|
363 | (2) |
|
FAQ 26.13: How might the exception-handling mechanism cause a program to silently crash? |
|
|
365 | (2) |
|
Chapter 27 Types and RTTI |
|
|
367 | (20) |
|
FAQ 27.01: What is the purpose of this chapter? |
|
|
367 | (1) |
|
FAQ 27.02: What is static type checking? |
|
|
367 | (1) |
|
FAQ 27.03: What is dynamic type checking? |
|
|
368 | (2) |
|
FAQ 27.04: What is the basic problem with dynamic type checking? |
|
|
370 | (1) |
|
FAQ 27.05: How can dynamic type checking be avoided? |
|
|
371 | (1) |
|
FAQ 27.06: Are there better alternatives to dynamic type checking? |
|
|
371 | (2) |
|
FAQ 27.07: What is a capability query? |
|
|
373 | (1) |
|
FAQ 27.08: What is an alternative to dynamic type checking with containers? |
|
|
373 | (1) |
|
FAQ 27.09: Are there cases where dynamic type checking is necessary? |
|
|
374 | (1) |
|
FAQ 27.10: Given a pointer to an ABC, how can the class of the referent be found? |
|
|
374 | (2) |
|
FAQ 27.11: What is a downcast? |
|
|
376 | (2) |
|
FAQ 27.12: What is an alternative to using downcasts? |
|
|
378 | (2) |
|
FAQ 27.13: Why are downcasts dangerous? |
|
|
380 | (1) |
|
FAQ 27.14: Should the inheritance graph of C++ hierarchies be tall or short? |
|
|
380 | (1) |
|
FAQ 27.15: Should the inheritance graph of C++ hierarchies be monolithic or a forest? |
|
|
381 | (1) |
|
FAQ 27.16: What is Runtime Type Identification (RTTI)? |
|
|
381 | (1) |
|
FAQ 27.17: What is the purpose of dynamic_cast[T] ()? |
|
|
381 | (2) |
|
FAQ 27.18: Is dynamic_cast [T] () a panacea? |
|
|
383 | (1) |
|
FAQ 27.19: What does static_cast [T] () do? |
|
|
383 | (1) |
|
FAQ 27.20: What does typeid () do? |
|
|
383 | (1) |
|
FAQ 27.21: Are there any hidden costs for type-safe downcasts? |
|
|
384 | (3) |
|
|
|
387 | (14) |
|
FAQ 28.01: What are container classes and what are the most common mistakes made with container classes? |
|
|
387 | (1) |
|
FAQ 28.02: Are arrays good or evil? |
|
|
388 | (1) |
|
FAQ 28.03: Should application development organizations create their own container classes? |
|
|
388 | (1) |
|
FAQ 28.04: What are some common mistakes with containers of pointers? |
|
|
389 | (1) |
|
FAQ 28.05: Does this mean that containers of pointers should be avoided? |
|
|
390 | (1) |
|
FAQ 28.06: Surely good old-fashioned char * is an exception, right? |
|
|
390 | (1) |
|
FAQ 28.07: Can auto_ptr [T] simplify ownership problems with containers of pointers? |
|
|
391 | (1) |
|
FAQ 28.08: Can a Java-like Object class simplify containers in C++? |
|
|
391 | (1) |
|
FAQ 28.09: What's the difference between a homogeneous and a heterogeneous container? |
|
|
392 | (1) |
|
FAQ 28.10: Is it a good idea to use a "best of breed" approach when selecting container classes? |
|
|
392 | (1) |
|
FAQ 28.11: Should all projects use C++'s standardized containers? |
|
|
393 | (1) |
|
FAQ 28.12: What are the C++ standardized container classes? |
|
|
394 | (1) |
|
FAQ 28.13: What are the best applications for the standardized C++ sequence container classes? |
|
|
394 | (4) |
|
FAQ 28.14: What are the best situations for the standardized C++ associative container classes? |
|
|
398 | (3) |
| Part IV Topics |
|
401 | (166) |
|
Chapter 29 Mixing Overloading with Inheritance |
|
|
403 | (12) |
|
FAQ 29.01: What is the difference between overloaded functions and overridden functions? |
|
|
403 | (1) |
|
FAQ 29.02: What is the hiding rule? |
|
|
404 | (3) |
|
FAQ 29.03: How should the hiding rule be handled? |
|
|
407 | (2) |
|
FAQ 29.04: What should a derived class do when it redefines some but not all of a set of overloaded member functions inherited from the base class? |
|
|
409 | (2) |
|
FAQ 29.05: Can virtual functions be overloaded? |
|
|
411 | (4) |
|
|
|
415 | (18) |
|
FAQ 30.01: What is the purpose of this chapter? |
|
|
415 | (1) |
|
FAQ 30.02: What are the Big Three? |
|
|
415 | (1) |
|
FAQ 30.03: What happens when an object is destroyed that doesn't have an explicit destructor? |
|
|
416 | (1) |
|
FAQ 30.04: What happens if an object is copied but doesn't have an explicit copy constructor? |
|
|
417 | (1) |
|
FAQ 30.05: What happens when an object that doesn't have an explicit assignment operator is assigned? |
|
|
418 | (2) |
|
FAQ 30.06: What is the Law of the Big Three? |
|
|
420 | (1) |
|
FAQ 30.07: Which of the Big Three usually shows up first? |
|
|
420 | (1) |
|
FAQ 30.08: What is remote ownership? |
|
|
421 | (1) |
|
FAQ 30.09: How is remote ownership special? |
|
|
422 | (1) |
|
FAQ 30.10: What if a class owns a referent and doesn't have all of the Big Three? |
|
|
422 | (2) |
|
FAQ 30.11: Are there any C++ classes that help manage remote ownership? |
|
|
424 | (2) |
|
FAQ 30.12: Does auto_ptr enforce the Law of the Big Three and solve the problems associated with remote ownership? |
|
|
426 | (2) |
|
FAQ 30.13: Are there cases where one or two of the Big Three may be needed but not all three? |
|
|
428 | (1) |
|
FAQ 30.14: Are there any other circumstances that might explicitly warrant the Big Three? |
|
|
429 | (1) |
|
FAQ 30.15: Why does copying an object using memcpy () cause a program crash? |
|
|
430 | (1) |
|
FAQ 30.16: Why do programs with variable-length argument lists crash? |
|
|
431 | (1) |
|
FAQ 30.17: Why do programs that use realloc () to reallocate an array of objects crash? |
|
|
432 | (1) |
|
Chapter 31 Using Objects to Prevent Memory Leaks |
|
|
433 | (18) |
|
FAQ 31.01: When are memory leaks important? |
|
|
433 | (1) |
|
FAQ 31.02: What is the easiest way to avoid memory leaks? |
|
|
434 | (2) |
|
FAQ 31.03: What are the most important principles for resource management? |
|
|
436 | (1) |
|
FAQ 31.04: Should the object that manages a resource also perform operations that may throw exceptions? |
|
|
437 | (1) |
|
FAQ 31.05: Should an object manage two or more resources? |
|
|
438 | (2) |
|
FAQ 31.06: What if an object has a pointer to an allocation and one of the object's member functions deletes the allocation? |
|
|
440 | (1) |
|
FAQ 31.07: How should a pointer variable be handled after being passed to delete? |
|
|
440 | (1) |
|
FAQ 31.08: What should be done with a pointer to an object that is allocated and deallocated in the same scope? |
|
|
441 | (1) |
|
FAQ 31.09: How easy is it to implement reference counting with pointer semantics? |
|
|
442 | (1) |
|
FAQ 31.10: Is reference counting with copy-on-write semantics hard to implement? |
|
|
443 | (3) |
|
FAQ 31.11: How can reference counting be implemented with copy-on-write semantics for a hierarchy of classes? |
|
|
446 | (5) |
|
Chapter 32 Wild Pointers and Other Devilish Errors |
|
|
451 | (10) |
|
FAQ 32.01: What is a wild pointer? |
|
|
451 | (1) |
|
FAQ 32.02: What happens to a program that has even one wild pointer? |
|
|
452 | (1) |
|
FAQ 32.03: What does the compiler mean by the warning "Returning a reference to a local object"? |
|
|
452 | (1) |
|
FAQ 32.04: How should pointers across block boundaries be controlled? |
|
|
453 | (1) |
|
FAQ 32.05: Is the reference-versus-pointer issue influenced by whether or not the object is allocated from the heap? |
|
|
454 | (1) |
|
FAQ 32.06: When should C-style pointer casts be used? |
|
|
455 | (1) |
|
FAQ 32.07: Is it safe to bind a reference variable to a temporary object? |
|
|
455 | (1) |
|
FAQ 32.08: Should a parameter passed by const reference be returned by const reference? |
|
|
456 | (1) |
|
FAQ 32.09: Should template functions for things like min (X, Y) or abs (X) return a const reference? |
|
|
457 | (1) |
|
FAQ 32.10: When is zero not necessarily zero? |
|
|
457 | (4) |
|
Chapter 33 High-Performance Software |
|
|
461 | (20) |
|
FAQ 33.01: Is bad performance a result of bad design or bad coding? |
|
|
461 | (1) |
|
FAQ 33.02: What are some techniques for improving performance? |
|
|
462 | (1) |
|
FAQ 33.03: What is an advantage of using pointers and references? |
|
|
463 | (2) |
|
FAQ 33.04: What is a disadvantage of lots of references and pointers? |
|
|
465 | (2) |
|
FAQ 33.05: How else can member objects improve performance over pointers? |
|
|
467 | (1) |
|
FAQ 33.06: Which is better, ++i or i++? |
|
|
468 | (2) |
|
FAQ 33.07: What is the performance difference between Fred X(5); and Fred Y=5; and Fred z=Fred(5);? |
|
|
470 | (1) |
|
FAQ 33.08: What kinds of applications should consider using final classes and final member functions? |
|
|
471 | (1) |
|
FAQ 33.09: What is a final class? |
|
|
471 | (1) |
|
FAQ 33.10: What is a final member function? |
|
|
472 | (1) |
|
FAQ 33.11: How can final classes and final member functions improve performance? |
|
|
473 | (1) |
|
FAQ 33.12: When should a nonfinal virtual function be invoked with a fully qualified name? |
|
|
474 | (1) |
|
FAQ 33.13: Should full qualification be used when calling another member function of the same class? |
|
|
475 | (1) |
|
FAQ 33.14: Do final classes and final member functions cause a lot of code duplication? |
|
|
476 | (2) |
|
FAQ 33.15: Why do some developers dislike final member functions and final classes? |
|
|
478 | (1) |
|
FAQ 33.16: Can a programming language-rather than just the compiler-affect the performance of software? |
|
|
478 | (3) |
|
Chapter 34 COM and Active X |
|
|
481 | (46) |
|
FAQ 34.01: Who should read this chapter? |
|
|
481 | (1) |
|
FAQ 34.02: What is the Component Object Model? |
|
|
481 | (1) |
|
FAQ 34.03: What are ActiveX and OLE? |
|
|
482 | (1) |
|
FAQ 34.04: What does the name Component Object Model mean? |
|
|
483 | (1) |
|
FAQ 34.05: What is a "binary object model"? |
|
|
483 | (1) |
|
FAQ 34.06: What are the key features of COM? |
|
|
484 | (1) |
|
FAQ 34.07: What are GUIDs? |
|
|
485 | (1) |
|
FAQ 34.08: Why does COM need GUIDs (and CLSIDs and IIDs)? |
|
|
486 | (1) |
|
FAQ 34.09: What is an interface? |
|
|
487 | (1) |
|
FAQ 34.10: What is the IUnknown interface? |
|
|
488 | (1) |
|
FAQ 34.11: How many ways are there to specify COM interfaces? |
|
|
490 | (2) |
|
FAQ 34.12: What are COM classes and COM objects? |
|
|
492 | (4) |
|
FAQ 34.13: How hard is it for callers to create and use a COM object? |
|
|
496 | (2) |
|
FAQ 34.14: How does COM provide language transparency? |
|
|
498 | (1) |
|
FAQ 34.15: How does COM provide location transparency? |
|
|
499 | (1) |
|
FAQ 34.16: What types of errors occur due to reference counting? |
|
|
500 | (1) |
|
FAQ 34.17: What mechanism does COM define for error handling? |
|
|
501 | (1) |
|
FAQ 34.18: How are interfaces versioned? |
|
|
502 | (1) |
|
FAQ 34.19: Is COM object oriented? |
|
|
503 | (1) |
|
FAQ 34.20: What is the biggest problem with COM? |
|
|
504 | (1) |
|
FAQ 34.21: What are the major differences between COM and C++? |
|
|
504 | (4) |
|
FAQ 34.22: When should a class be defined as a COM class? |
|
|
508 | (1) |
|
FAQ 34.23: What is Automation? |
|
|
509 | (1) |
|
FAQ 34.24: What are dispatch interfaces? |
|
|
510 | (1) |
|
FAQ 34.25: When should a class expose a Dispatch interface? |
|
|
511 | (1) |
|
FAQ 34.26: How does Automation work? |
|
|
512 | (2) |
|
FAQ 34.27: How does Invoke accomplish all of this? |
|
|
514 | (1) |
|
FAQ 34.28: What is a type library? |
|
|
514 | (1) |
|
FAQ 34.29: What are the benefits of using type libraries? |
|
|
515 | (1) |
|
FAQ 34.30: How do type libraries improve performance? |
|
|
516 | (1) |
|
FAQ 34.31: What are dual interfaces? |
|
|
516 | (2) |
|
FAQ 34.32: What limitations are there on dual interfaces? |
|
|
518 | (1) |
|
FAQ 34.33: What are OLE custom controls and ActiveX controls? |
|
|
519 | (1) |
|
FAQ 34.34: Why do ActiveX controls differ from OLE custom controls? |
|
|
520 | (1) |
|
FAQ 34.35: What is a control container? |
|
|
521 | (1) |
|
FAQ 34.36: What are component categories? |
|
|
522 | (1) |
|
FAQ 34.37: What are events? |
|
|
522 | (1) |
|
|
|
523 | (1) |
|
FAQ 34.39: How stable is DCOM's infrastructure? |
|
|
524 | (1) |
|
|
|
524 | (3) |
|
Chapter 35 Transitioning to CORBA |
|
|
527 | (8) |
|
FAQ 35.01: What is CORBA? |
|
|
527 | (1) |
|
FAQ 35.02: What is an ORB? |
|
|
527 | (1) |
|
|
|
528 | (1) |
|
|
|
528 | (1) |
|
|
|
528 | (1) |
|
|
|
529 | (1) |
|
FAQ 35.07: What is the purpose of this chapter? |
|
|
529 | (1) |
|
FAQ 35.08: What is the most important message of this chapter? |
|
|
529 | (1) |
|
FAQ 35.09: What are the important concepts behind CORBA? |
|
|
530 | (1) |
|
FAQ 35.10: Isn't OMG IDL pretty much the same as C++? |
|
|
531 | (1) |
|
FAQ 35.11: Is the lifecycle of a CORBA object the same as the life cycle of a C++ object? |
|
|
532 | (1) |
|
FAQ 35.12: Is the C++ code that interacts with the CORBA implementation portable to a different CORBA vendor? |
|
|
533 | (1) |
|
FAQ 35.13: How do CORBA exceptions compare to C++ exceptions? |
|
|
533 | (1) |
|
FAQ 35.14: Which CORBA implementation is best? Is CORBA better than COM? |
|
|
534 | (1) |
|
Chapter 36 C Language Considerations |
|
|
535 | (10) |
|
FAQ 36.01: What are the main issues when mixing C and C++ code in the same application? |
|
|
535 | (1) |
|
FAQ 36.02: How can C++ code call C code? |
|
|
536 | (1) |
|
FAQ 36.03: How can C code call C++ code? |
|
|
537 | (1) |
|
FAQ 36.04: Why is the linker giving errors for C functions called from C++ functions and vice versa? |
|
|
538 | (1) |
|
FAQ 36.05: How can an object of a C++ class be passed to or from a C function? |
|
|
538 | (2) |
|
FAQ 36.06: Can a C function directly access data in an object of a C++ class? |
|
|
540 | (1) |
|
36.07: Can C++ I/O ([ostroam] be mixed with C I/O ([stdio.h])? |
|
|
541 | (1) |
|
FAQ 36.08: Which is safer: [iostream] or [stdio.h]? |
|
|
541 | (1) |
|
FAQ 36.09: Which is more extensible: [iostream] or [stdio.h]? |
|
|
542 | (1) |
|
FAQ 36.10: Which is more flexible: [iostream] or [stdio.h]? |
|
|
542 | (1) |
|
FAQ 36.11: Why does it seem that C++ programming feels farther away from the machine than C? |
|
|
543 | (1) |
|
FAQ 36.12: Why does C++ do more things behind your back than C does? |
|
|
543 | (2) |
|
Chapter 37 Private and Protected Inheritance |
|
|
545 | (8) |
|
FAQ 37.01: What are private inheritance and protected inheritance? |
|
|
545 | (1) |
|
FAQ 37.02: What is the difference between private inheritance and protected inheritance? |
|
|
546 | (1) |
|
FAQ 37.03: What is the syntax and semantics for private and protected inheritance? |
|
|
547 | (1) |
|
FAQ 37.04: When should normal has-a be used, rather than private or protected inheritance? |
|
|
548 | (1) |
|
FAQ 37.05: What are the access rules for public, protected, and private inheritance? |
|
|
549 | (1) |
|
FAQ 37.06: In a private or protected derived class, how can a member function that was public in the base class be made public in the derived class? |
|
|
550 | (1) |
|
FAQ 37.07: Should a pointer be cast from a private or protected derived class to its base class? |
|
|
551 | (2) |
|
Chapter 38 Pointers to Member Functions |
|
|
553 | (6) |
|
FAQ 38.01: What is the type of a pointer to a nonstatic member function? |
|
|
553 | (2) |
|
FAQ 38.02: Can pointers to nonstatic member functions be passed to signal handlers, X event call-back handlers, and so on, that expect C-like function pointers? |
|
|
555 | (1) |
|
FAQ 38.03: What is one of the most common errors when using pointers to member functions? |
|
|
556 | (1) |
|
FAQ 38.04: How is an array of pointers to nonstatic member functions declared? |
|
|
556 | (3) |
|
Chapter 39 The Transition to OO and C++ |
|
|
559 | (8) |
|
FAQ 39.01: Who should read this chapter? |
|
|
559 | (1) |
|
FAQ 39.02: What are the key messages of this chapter? |
|
|
559 | (1) |
|
FAQ 39.03: How many stages of technical expertise are there in the transition? |
|
|
560 | (1) |
|
FAQ 39.04: Why bother defining levels of expertise? |
|
|
561 | (1) |
|
FAQ 39.05: Can OO/C++ be learned from a book? |
|
|
561 | (1) |
|
FAQ 39.06: Can OO/C++ be learned from a course? |
|
|
562 | (1) |
|
FAQ 39.07: What is the key to learning OO/C++? |
|
|
562 | (1) |
|
FAQ 39.08: Are small projects a good way to get your feet wet? |
|
|
563 | (1) |
|
FAQ 39.09: Does being a good C programmer help when learning OO/C++? |
|
|
564 | (1) |
|
FAQ 39.10: What skills help when learning OO/C++? |
|
|
565 | (2) |
| Index |
|
567 | |