It is also possible to redefine a function within the class:
class Default_output_thingie {
protected void default_output(string fmt, mixed ...) {
write(fmt, @mixed);
}
function(string, mixed ...:void) output = default_output;
}
object my_output_object = Default_output_thinge();
my_output_object->output = werror;
So with a clever output object, it would be possible to provide users
with a simple way of just redefining a filter function or such to
modify the output. More advanced users may still want to replace the
whole class for greater controll, possibly inheriting the default
implementation.
|