Everardo Cunha · Aug 17, 2020

Cache; Create methods with same name but different parameters


Since cache is an OOP language, how can I create 2 methods with the same name but different parameters? Right now when I try that I get a compile time error!

Element name conflict [80670005] : Method mymethod

Thank you,




2 0 5 151
Log in or sign up to continue


it is not possible within the same class as you break the uniqueness of names.

But if you have class A1 with Method MX(....)  
you can create class A2 Extends A1 and overload Method MX as you like or need.
You still can call MX of class A1 from class A2 using ##super()

All with the assumption that neither class A1 nor Method MX is FINAL


Thank you so much for your answer!

Stay safe,


Currently ObjectScript doesn't support method override. But you might be able to simulate it by using rest parameters and delegating to a second private method that handles it according to what has been provided to the initial method.

EDIT: Whoops! I meant overload.


I was trying to avoid that since I wanted to leave the original method untouched! Anyway, thank you so much!



Method (or Function) overloading isn't necessarily an OOP-thing.
Many programming languages only allow a constructor to have the name of the class itself.
In COS you can have many constructors with different names and signatures, so overloading isn't really needed.