
22 May
2004
22 May
'04
1:03 a.m.
Rob Stewart <stewart@sig.com> writes:
From: "Reece Dunn" <msclrhd@hotmail.com>
Q: Since the above is valid C++, is the following?: virtual void myfn( char ) = 0; virtual void myfn( int, bool ) = 0;
Absolutely. You can overload virtual functions just like non-virtual functions.
But unless they're all going to be overridden in one single class you're better off using the "template method pattern" and dispatching to differently-named functions to avoid problems with name hiding... or just be disciplined about bringing the base names into derived classes everywhere with "using". -- Dave Abrahams Boost Consulting http://www.boost-consulting.com