Defining another function using the same callback address of existing one
ID: 5
using uCalcSoftware;
var uc = new uCalc();
uc.DefineFunction("MyRound(x)", uc.ItemOf("Floor").FunctionAddress);
Console.WriteLine(uc.Eval("MyRound(2.5)"));
uc.ItemOf("MyRound").SetFunctionAddress(uc.ItemOf("Ceil").FunctionAddress);
Console.WriteLine(uc.Eval("MyRound(2.5)"));
2
3 using uCalcSoftware; var uc = new uCalc(); uc.DefineFunction("MyRound(x)", uc.ItemOf("Floor").FunctionAddress); Console.WriteLine(uc.Eval("MyRound(2.5)")); uc.ItemOf("MyRound").SetFunctionAddress(uc.ItemOf("Ceil").FunctionAddress); Console.WriteLine(uc.Eval("MyRound(2.5)"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uc.DefineFunction("MyRound(x)", uc.ItemOf("Floor").FunctionAddress());
cout << uc.Eval("MyRound(2.5)") << endl;
uc.ItemOf("MyRound").SetFunctionAddress(uc.ItemOf("Ceil").FunctionAddress());
cout << uc.Eval("MyRound(2.5)") << endl;
}
2
3 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uc.DefineFunction("MyRound(x)", uc.ItemOf("Floor").FunctionAddress()); cout << uc.Eval("MyRound(2.5)") << endl; uc.ItemOf("MyRound").SetFunctionAddress(uc.ItemOf("Ceil").FunctionAddress()); cout << uc.Eval("MyRound(2.5)") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
uc.DefineFunction("MyRound(x)", uc.ItemOf("Floor").FunctionAddress)
Console.WriteLine(uc.Eval("MyRound(2.5)"))
uc.ItemOf("MyRound").SetFunctionAddress(uc.ItemOf("Ceil").FunctionAddress)
Console.WriteLine(uc.Eval("MyRound(2.5)"))
End Sub
End Module
2
3 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("MyRound(x)", uc.ItemOf("Floor").FunctionAddress) Console.WriteLine(uc.Eval("MyRound(2.5)")) uc.ItemOf("MyRound").SetFunctionAddress(uc.ItemOf("Ceil").FunctionAddress) Console.WriteLine(uc.Eval("MyRound(2.5)")) End Sub End Module