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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -