< previous page page_280 next page >

Page 280
Q&A.
A Why not make all class functions virtual?
A There is overhead with the first virtual function in the creation of a v-table. After that, the overhead is trivial. Many C++ programmers feel that if one function is virtual, all others should be. Other programmers disagree, feeling that there should always be a reason for what you do.
Q If a function SomeFunc() is virtual in a base class and is also overloaded so as to take either an integer or two integers, and the derived class overrides the form taking one integer, what is called when a pointer to a derived object calls the two-integer form?
A The overriding of the one int form hides the entire base class function; thus you will get a compile error complaining that the function requires only one int.

 
< previous page page_280 next page >

If you like this book, buy it!