what is reference in programming code example

Example: reference in programming

var student : Student = new Student("Jim");   // the "student" variable contains a reference to "Jim"               var other   : Student = student;              // the "other" variable also contains a reference to "Jim"                 student.name = "James"; // rename the student                trace("The students name is: " + student.name ); // prints James                trace("The other name is: " + student.name ); // prints James as well                other.name = "Joe";                trace("The students name is: " + student.name ); // Prints Joe!

Tags:

Misc Example