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' -

Google sheets equipment borrowing system -

c# - Ploeh AutoFixture was unable to create an instance from System.Runtime.Serialization.ExtensionDataObject -