objectmemberwiseclone

September 14, 2025 ยท View on GitHub

Shows hows how to use xtd::object::memberwise_clone method.

Sources

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

Original values of p1 and p2:
   p1 instance values: 
      name: Sam, age: 42
      value: 6565
   p2 instance values:
      name: Sam, age: 42
      value: 6565

Values of p1 and p2 after changes to p1:
   p1 instance values: 
      name: Frank, age: 32
      value: 7878
   p2 instance values:
      name: Frank, age: 42
      value: 7878

Values of p1 and p3 after changes to p1:
   p1 instance values: 
      name: George, age: 39
      value: 8641
   p3 instance values:
      name: Frank, age: 32
      value: 7878