[Gambas-user] Method Overloading (reprise)

Laurent Carlier lordheavy at ...512...
Mon Jan 17 15:42:30 CET 2005


Le Lundi 17 Janvier 2005 14:42, Brant Wells a écrit :
> Hey Jim:
>
> What is method overloading??  (I dont' recall ever hearing that phrase
> before...)
>
> Thanks!
> ~Brant
>

with c++, method overloading meaning to define several methods with the same 
names but arguments are differents and interpreter choose the method to call 
from the type of arguments :

public sub mymethod(toto as string)
  print "length : " & str(len(toto))
end
sub mymethod(toto as integer)
  print "result : " & str(toto*2)
end

then if you call :
mymethod("test")
-> length : 4
mymethod(5)
-> result : 10

But i think Gambas doesn't support overloading actually :)

Regards,

-- 

Laurent Carlier




More information about the User mailing list