Doing an Eval in the same uCalc instance a variable belongs to

ID: 33

				
					using uCalcSoftware;

var uc = new uCalc();
var uc1 = new uCalc();
var uc2 = new uCalc();

var x1 = uc1.DefineVariable("x = 5");
var x2 = uc2.DefineVariable("x = 6");

Console.WriteLine(x1.uCalc.Eval("x*10")); // Same as uc1.Eval("x*10")
Console.WriteLine(x2.uCalc.Eval("x*10")); // Same as uc2.Eval("x*10")

uc1.Release();  // Since x1 is part of uc1, x1 is automatically released as well
uc2.Release();  // Since x2 is part of uc2, x2 is automatically released as well

// You should no longer use x1 or x2 because they were part of uc1 & uc2
// Don not try x1.uCalc().Eval("x*10"); or x2.uCalc().Eval("x*10");
				
			
50
60
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc uc1;
   uCalc uc2;

   auto x1 = uc1.DefineVariable("x = 5");
   auto x2 = uc2.DefineVariable("x = 6");

   cout << x1.uCalc().Eval("x*10") << endl; // Same as uc1.Eval("x*10")
   cout << x2.uCalc().Eval("x*10") << endl; // Same as uc2.Eval("x*10")

   uc1.Release();  // Since x1 is part of uc1, x1 is automatically released as well
   uc2.Release();  // Since x2 is part of uc2, x2 is automatically released as well

   // You should no longer use x1 or x2 because they were part of uc1 & uc2
   // Don not try x1.uCalc().Eval("x*10"); or x2.uCalc().Eval("x*10");
}
				
			
50
60
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim uc1 As New uCalc()
      Dim uc2 As New uCalc()
      
      Dim x1 = uc1.DefineVariable("x = 5")
      Dim x2 = uc2.DefineVariable("x = 6")
      
      Console.WriteLine(x1.uCalc.Eval("x*10")) '// Same as uc1.Eval("x*10")
      Console.WriteLine(x2.uCalc.Eval("x*10")) '// Same as uc2.Eval("x*10")
      
      uc1.Release()  '// Since x1 is part of uc1, x1 is automatically released as well
      uc2.Release()  '// Since x2 is part of uc2, x2 is automatically released as well
      
      '// You should no longer use x1 or x2 because they were part of uc1 & uc2
      '// Don not try x1.uCalc().Eval("x*10"); or x2.uCalc().Eval("x*10");
   End Sub
End Module
				
			
50
60