|
|
In SAC, you can overload functions like this:
|
|
|
|
|
|
```c
|
|
|
use StdIO: all;
|
|
|
|
|
|
void foo(int a) { printf("Called foo with int\n"); return;}
|
|
|
void foo(bool a) { printf("Called foo with bool \n"); }
|
|
|
void foo(int[+] a) { printf("Called foo with int[+]\n"); }
|
|
|
void foo(int[3] a) { printf("Called foo with int[3]\n"); }
|
|
|
|
|
|
int main() {
|
|
|
foo(1);
|
|
|
foo(true);
|
|
|
foo([1]);
|
|
|
foo([1,2,3]);
|
|
|
return 0;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
This program should output:
|
|
|
|
|
|
```
|
|
|
Called foo with int
|
|
|
Called foo with bool
|
|
|
Called foo with int[+]
|
|
|
Called foo with int[3]
|
|
|
``` |
|
|
\ No newline at end of file |