Title: Temp objects copied by val or ref?

Greetings,

I've got a template which requires #n# objects of the same type, each to be appended into a separate object.

Is it advisable to create a single temporary object for temporary use before appending, or will I end up changing all of the values for each previously-used object?

Basically: are objects copied into other objects by value or reference?

Example of what I'm hoping to do:
theFlight = createObject("component","com.app.flight").init();
tmpLeg = createObject("component","com.app.leg").init();
gotLegs = true;
legCount = 0;
while (gotLegs) {
   legCount = legCount + 1;
   if (NOT structKeyExists(form,"leg"&legCount)) {
      gotLegs = false;
      break;
   }
   tmpLeg.obtainById(StructFind(form, "leg"&legCount));
   theFlight.addLeg(tmpLeg);
}

Will every leg in the flight end up with the last leg's data?

--
Eric C. Davis
Programmer/Analyst I
Georgia Department of Transportation
Office of I.T. Applications
Web Applications Group
404.463.2860.199
[EMAIL PROTECTED]

Reply via email to