2.2. Overloading
Felix supports overloading. To demonstrate this,
we'll make a small modification to the hello
world program. You can compile and run the
program as before, just change the example number.
Start felix section to tut/tutorial/tut-1.02-0.flx[1
/1
]
1: #line 72 "./lpsrc/flx_tutorial.pak"
2:
3: print "Hello World ";
4: print 42;
5: print "\n";
Start data section to tut/tutorial/tut-1.02-0.expect[1
/1
]
Here you can see that there are two procedures,
one to print strings, and one to print ints,
but they're both called 'print'.
Felix allows procedures and functions to be
overloaded, as does C++. However, unlike C++,
Felix has no automatic conversions, and
overload matching must be exact.