+ Start a Discussion

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

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

Thanks in advance 
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
for pass by reference and pass by value refer the below link :