[Gambas-user] Method overloading in Gambas

David Paleino d.paleino at ...626...
Thu Feb 5 16:16:34 CET 2009


On Thu, 5 Feb 2009 16:13:03 +0100, David Paleino wrote:

> [..]
> This is easily doable using a "helper" sub, like:
> 
> ---8<---
> PUBLIC SUB Method()
>     Arg1 = [..] ' get these from somewhere
>     Arg2 = [..]
>     DoStuff(Arg1, Arg2)
> END SUB
> 
> PUBLIC SUB Method(Arg1 AS Variant, Arg2 AS Variant)
>     DoStuff(Arg1, Arg2)
> END SUB
> 
> PRIVATE SUB DoStuff(Arg1 AS Variant, Arg2 AS Variant)
>     [..]
> END SUB
> --->8---

I just realized after sending the message... the second Method() would fail at
compilation time, because it is already declared... Yes, overloading is the only
way to do this :)

Ciao,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090205/052012e1/attachment.sig>


More information about the User mailing list