oop - Overriding a method with more parameters in java? -


i have base class method called execute :

class {     public execute(int a){} } 

i have class b, extends a, execute method needs more parameters:

currently, solution using optional parameters :

class b extends {     public execute(int a, object... parameters){         long b = (long)parameters[0];         boolean c = (boolean)parameters[1];         ....     } } 

this still ugly because must cast on parameters. there other options situation?

you can add execute(int a, int b) in b, won't override execute(int a) method, overload it. both method callable on instance of b.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -