@Jeroen:
Step-by-Step:
Declare a function pointer called TrigFunction. TrigFunction isn't defined at the moment, all we have told the compiler is what it returns (a double float) and what parameters in accepts (a double float)
Set the function pointer to the "Sin" function. So whenever we call TrigFunction it will actually call the Sin function. Because TrigFunction (as defined above) and Sin both accept the same arguments and return the same data type, this is OK.
Demonstrate calling TrigFunction, because TrigFunction now "points" at the Sin function, TrigFunction(0.0) is the same as Sin(0.0)
Now set TrigFunction to Cos instead, so that calling TrigFunction(0.0) is the same as Cos(0.0)
Step-by-Step:
Declare a function pointer called TrigFunction. TrigFunction isn't defined at the moment, all we have told the compiler is what it returns (a double float) and what parameters in accepts (a double float)
Local TrigFunction!( x! )
Set the function pointer to the "Sin" function. So whenever we call TrigFunction it will actually call the Sin function. Because TrigFunction (as defined above) and Sin both accept the same arguments and return the same data type, this is OK.
TrigFunction = Sin
Demonstrate calling TrigFunction, because TrigFunction now "points" at the Sin function, TrigFunction(0.0) is the same as Sin(0.0)
Print TrigFunction( 0.0 )
Now set TrigFunction to Cos instead, so that calling TrigFunction(0.0) is the same as Cos(0.0)
TrigFunction = Cos Print TrigFunction( 0.0 )