
On Sat, May 3, 2008 at 8:00 AM, Hartmut Kaiser <hartmut.kaiser@gmail.com> wrote:
What's the problem with making the destructor virtual in the first place? Since the class already has other virtual functions this won't generate any (significant) additional overhead (the only thing what's added is another function pointer to the already existing virtual function table, barely something to worry about).
I am not concerned about overhead. In C++, you use virtual function calls only when your design requires polymorphic behavior. My design does not. If GCC issued a warning if you have a non-virtual function in a class that has some virtual functions, would you make the non-virtual function virtual? (hint: much like the destructor case, using non-virtual function in the first place _could_ be a serious bug.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode