C++ static_cast runtime overhead
问题 See the code below. a) Does, in this case (simple inheritance, no virtual members), the static cast in B::df() have any overhead (whatsoever)? I found some conflicting answers to similar questions, that's why I am asking... b) I was thinking about making const M1 * func private in A and introducing a new private field const M2 * func into B to avoid the cast, but it kind of complicates things up and makes use of smart pointers more difficult. Do you see a better way to avoid the cast? class