Jump to content

Overloading Functions


Guest Py7|-|[]/\/
 Share

Recommended Posts

Guest Py7|-|[]/\/

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?

Link to comment
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!
Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...