You need to sign in to do that
Don't have an account?

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
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
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