vsgdp wrote:
Is it considered to be bad form to have an abstract method where some of
the parameters are ignored by derived classes?
To rate a design, imagine how easily you could extend it in the future.
I'm writing a class that contains an abstract method. The output of the
method can depend on several parameters (but could also only depend on
just one of them). So my idea was to always pass all the parameters, then
derived classes can pick and choose which parameterrs to use in the
implementation of the method.
That might cause a bad surprise when you add a new class or method. You
might have trouble figuring out why it's not working - because the derived
class neglects the parameter you upgraded.
You may like a Visitor or Double-Dispatch pattern there. The argument you
pass in is itself a type with virtual functions, and they in turn find the
target behaviors.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!