Sign in to follow this  
Followers 0
Guest Py7|-|[]/\/

Overloading Functions

4 posts in this topic

In Java it is possible to overload methods.

Ex: public int numbers(String name, int testing)

public int numbers(String name, int testing, int formal)

Is this possible in AutoIt? And also, how would it be possible to call a specific function if it is overloaded?

Share this post


Link to post
Share on other sites



The closest match is optional parameters in the newest beta. Here's an example:

My_WinActivate("TitleZero")
My_WinActivate("TitleOne", "TextOne")
Exit

;For example only; it's not that useful
Func My_WinActivate($title, $text = "")
   If @NumParams = 1 Then
      Return WinActivate($title)
   Else
      Return WinActivate($title, $text)
   EndFunc
EndFunc

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Java is also a typed language, where-as AutoIt is not, so its completely unnecessary to be able to overload a function. If its imperative you do different things based on the contents of a variable, then use the StringIs* functions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0