Cloning a class
Monkey Forums/Monkey Programming/Cloning a class
| ||
Is there an easy to way clone an instance of an object into another without manually copying every field one by one? |
| ||
Good question. http://en.wikipedia.org/wiki/Object_copy My guess is at the moment, no, you would have to copy field by field. |
| ||
Just for reference, Two common ways to do it is to either create a Copy() method, or to add a Overload to the Constructor that takes an object of the same sort. Local copiedCar:Car = car.Copy or Local copiedCar:Car = new Car( car ) |