Q&A
Q1: | What does percolating functionality upward mean? |
A1: | This refers to the idea of moving shared functionality upwards into a common base class. If more than one class shares a function, it is desirable to find a common base class in which that function can be stored. |
Q2: | Is percolating upward always a good thing? |
A2: | Yes, if you are percolating shared functionality upward; no, if all you are moving is interface. That is, if all the derived classes can't use the method, it is a mistake to move it up into a common base class. If you do, you'll have to switch on the runtime type of the object before deciding whether you can invoke the function. |
Q3: | Why is dynamic casting bad? |
A3: | The point of virtual functions is to let the virtual table, rather ... |
Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.