using System;
/******************************************************************************
https://openhome.cc/Gossip/JavaEssence/CallByValue.html
https://sites.google.com/site/dychen1127/developer-java/java-call-by-reference
Java Version : https://onlinegdb.com/HyRT42MGL
Types and variables
https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/types-and-variables
*******************************************************************************/
public class Program
{
public static void Main()
go();
}
public static void go() {
Customer c= new Customer();
c.name = "Justin";
c.x = 3;
some(c);
Console.WriteLine(c.name+" ;"+c.x );
private static void some(Customer cust) {
cust.name = "caterpillar"; //因為struct是屬於value types(存在記憶體Stack;Call by value),改變不了第19行的Justin
cust.x = 5;
struct Customer
public String name;
public int x;