Demonstrating that a clone is independent and that modifying it does not affect the original.

ID: 1054

See: Clone
				
					using uCalcSoftware;

var uc = new uCalc();
// 1. Create and configure the original transformer
var t1 = new uCalc.Transformer();
t1.FromTo("A", "B");
Console.WriteLine($"Original Transform: {t1.Transform("A C A")}");

// 2. Clone it
var t2 = t1.Clone();

// 3. Modify the clone. This does not affect the original.
t2.FromTo("C", "D");
Console.WriteLine($"Cloned Transform:   {t2.Transform("A C A")}");

// 4. Verify original is unchanged by re-running its transform
Console.WriteLine($"Original is Unchanged: {t1.Transform("A C A")}");
t2.Release();
t1.Release();
				
			
Original Transform: B C B
Cloned Transform:   B D B
Original is Unchanged: B C B
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // 1. Create and configure the original transformer
   uCalc::Transformer t1;
   t1.FromTo("A", "B");
   cout << "Original Transform: " << t1.Transform("A C A") << endl;

   // 2. Clone it
   auto t2 = t1.Clone();

   // 3. Modify the clone. This does not affect the original.
   t2.FromTo("C", "D");
   cout << "Cloned Transform:   " << t2.Transform("A C A") << endl;

   // 4. Verify original is unchanged by re-running its transform
   cout << "Original is Unchanged: " << t1.Transform("A C A") << endl;
   t2.Release();
   t1.Release();
}
				
			
Original Transform: B C B
Cloned Transform:   B D B
Original is Unchanged: B C B
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// 1. Create and configure the original transformer
      Dim t1 As New uCalc.Transformer()
      t1.FromTo("A", "B")
      Console.WriteLine($"Original Transform: {t1.Transform("A C A")}")
      
      '// 2. Clone it
      Dim t2 = t1.Clone()
      
      '// 3. Modify the clone. This does not affect the original.
      t2.FromTo("C", "D")
      Console.WriteLine($"Cloned Transform:   {t2.Transform("A C A")}")
      
      '// 4. Verify original is unchanged by re-running its transform
      Console.WriteLine($"Original is Unchanged: {t1.Transform("A C A")}")
      t2.Release()
      t1.Release()
   End Sub
End Module
				
			
Original Transform: B C B
Cloned Transform:   B D B
Original is Unchanged: B C B