
reference.language.methods_overloading.html Maven / Gradle / Ivy
Methods
Overloading methods
Prompto supports method overloading, where 2 methods have the same name but different parameters.
When a method is overloaded, Prompto selects the most appropriate one based on the best match of the proposed parameters
with respect to the required arguments. This matching is performed using the sequence of the parameters in the method call.
In the below example, the 2 methods have the same name, but a different number of arguments:
Method overloading also works with different argument types.
Each overridden method provides a behavior specific to its argument types.
When a method is overloaded, Prompto selects the most appropriate one at runtime i.e. the one for which the actual parameters best match the required method arguments,
based on the sequence of the method call. This is different from many languages such as Java, C# or C++,
where the resolution is decided at compile time.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy