If you have two classes extending the same base class, and need to make one of them override a function to take an additional parameter. Is it okay to always pass the additional parameter when calling the function on either class?
A bit of pseudo-code to help demonstrate...
If we have the 3 classes and functions
And I have an instance of one of these three, can I call $instance.doSomething($input)
I -think- what happens is that foo and foo_subclass_one would just ignore the additional parameter and foo_subclass_two would make use of it. Is this correct? Is there a better way I can do this if I have a lot of subclasses and really want to avoid touching 10+ files?
Thanks!
Yes you can. Gather them with func_get_args()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With