User Tools

Site Tools


method_overloading

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
method_overloading [2018/01/24 12:51] – created wolfgangriedmannmethod_overloading [2018/01/24 12:56] (current) wolfgangriedmann
Line 25: Line 25:
 oClass:Foo( 1234 ) oClass:Foo( 1234 )
 </code> </code>
-Please note: a different return type is not a different, so this will not compile:+Please note: a different return type is not a different signature, so this will not compile:
 <code>method Foo( cString as string ) as string <code>method Foo( cString as string ) as string
 .... ....
 method Foo( cString as string ) as int</code> method Foo( cString as string ) as int</code>
 +
 +Of course this applies also to longer parameter lists. Here a sample piece of code that uses overloaded constructors and chains them:
 +<code>class MyClass
 +  protect _cFullName as string
 +
 +constructor( cFullName as string )
 +  _cFullName := cFullName  
 +  return
 +  
 +constructor( cSurname as string, cName as string )
 +  super( cName + " " + cSurname )
 +  return</code>
 +
 +
  
  
method_overloading.1516798299.txt.gz · Last modified: 2018/01/24 12:51 by wolfgangriedmann