August 2001
Beginner
482 pages
10h 52m
English
| 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 ... |
Read now
Unlock full access