function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GangaGanga 

create a class with pass by reference and pass by value examples.

Hi friends 
Please help to write a class on the above requirement i just tryed the class its  getting Error
So please kindly rectifyor modify my code its a simple class no requirement they told me to create a class with pass by refernce and pass by value 

my Code 
public class Value
{
public String name{get;set;}

public Value(String n){

name= n;
}

Value val = new Value('Hello');
public void byReference(Value v){

System.debug('Value in: '+v.name);

v.name = 'Goodbye';
System.debug('Value out: '+v.name);
}
byReference(val);

System.debug('New value is:' +val.name);
}





Thanks in advance 
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
Hi,
for pass by reference and pass by value refer the below link :
http://blogs.developerforce.com/developer-relations/2012/05/passing-parameters-by-reference-and-by-value-in-apex.html