Should too many virtual functions raise a red flag?

Pages: 12
@ropez:
>>suppose they are more complex, each function may have a different set of subclasses that it handles, and there may be more than two levels in the class hierarchy.


I would not design a program as such in which it would have to handle hundreds of function check through a virtualy common function from their base class.
The design would be different in such case when there are hundreds of functions, as OO concept is to divide a big module into small objects and work on :)
BTW, I suspect many compilers have limitations on the number of virtual functions a single class can have. This is due to the way compilers handle pointer-to-virtual-member-functions. Without having actually looked at the GCC source, I'd bet that it has a limitation of 65,535 virtual functions. [This is because GCC would have no way to store a pointer to the 65,536th or beyond virtual member function].
For those that are interested: There's a new discussion related to this topic here:
http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/c16097aad186f98d#
Topic archived. No new replies allowed.
Pages: 12