in reply to Method parameters validation and inheritance
Interesting problem. If I understand the situation correctly, you have a base new method that has a few parameters, and a sub-class new method that has a few more parameters.
I would probably approach this in the sub-class new method by extracting the sub-class parameters from the hash, reserving them, calling the super-class' new method with just the parameters it understands, and then continue processing with the previously reserved parameters, operating on the new object. The destroy method may also have to do some destroy local and destroy super work.
In keeping with OO precepts, you want to make this process invisible to the base class.
|
|---|