Type detection: Difference between revisions

Content added Content deleted
Line 719: Line 719:
===Generic procedures (overloading)===
===Generic procedures (overloading)===
In the following, the name ''print_text'' refers to two distinct subroutines. Which of the two is called depends on the type of the argument in the call; the decision is made ''at compile time''.
In the following, the name ''print_text'' refers to two distinct subroutines. Which of the two is called depends on the type of the argument in the call; the decision is made ''at compile time''.

(To use this mechanism in a library, one would want to use modules. Nevertheless, the program below illustrates the principle more simply.)


<lang fortran>program type_detection_demo
<lang fortran>program type_detection_demo