How to retrieve a rule's parent uCalc instance and verify its identity.

ID: 997

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
var myRule = t.FromTo("A", "B");

// Get the parent uCalc from the rule
var parent_uc = myRule.uCalc;

// Verify they are the same instance using their MemoryIndex
Console.WriteLine(parent_uc.MemoryIndex == uc.MemoryIndex);
				
			
True
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   auto myRule = t.FromTo("A", "B");

   // Get the parent uCalc from the rule
   auto parent_uc = myRule.uCalc();

   // Verify they are the same instance using their MemoryIndex
   cout << tf(parent_uc.MemoryIndex() == uc.MemoryIndex()) << endl;
}
				
			
True
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      Dim myRule = t.FromTo("A", "B")
      
      '// Get the parent uCalc from the rule
      Dim parent_uc = myRule.uCalc
      
      '// Verify they are the same instance using their MemoryIndex
      Console.WriteLine(parent_uc.MemoryIndex = uc.MemoryIndex)
   End Sub
End Module
				
			
True