wrote:
> I just used printf() as an example. Actually I liked to use it in the
> other way.
> Anyway, thank you very much.
Well your function above isn't even described as virtual but you could
have a non-virtual method in the base-class that uses ... which then
expands to var_args and calls a virtual method. Something like;
class base
{
public:
void print( const std::string & format, ... )
{
va_list args;
va_begin( args, format ); // or whatever it is
do_print( format, args );
}
protected:
virtual void do_print( const std::string & format, va_list args );
};
A better way to print a variable argument list though is to get the
"variable" parameter to be some kind of collection. You can use an
operator like + between the arguments.