Tools.h++ Manual

104011 Tandem Computers Incorporated 20-1
Common Mistakes 20
We have made every effort to "tune" our libraries so as to minimize the chance
of a programming error. Nevertheless, C++ is an extremely complex language
with countless opportunities for making some very subtle mistakes.
In writing this chapter, we went though our technical support documents to
uncover the most common mistakes that our users were making. For those
that could be prevented, we tried to rewrite the library to make them
impossible. This is always the best approach, but may not always be possible.
For example, unacceptable performance degradations may result. Or the
language may not let you make the change.
This chapter summarized the most common mistakes that are left over. Take a
look through this list and, of course, make sure you have read the manual, if
you are having a problem.
20.1 Redefinition of virtual functions
If you subclass off an existing class and override a virtual function, make sure
that the overriding function has exactly the same signature as the overridden
function. This includes any "
const
" modifiers!
This problem arises particulary when creating new
RWCollectable
classes.