Copy object into another
- by EugeneP
Is there an easy way how to achieve this:
MyObj : (id, name);
MyObj myObj_1 = new MyObj(1, "Name 1");
MyObj myObj_2 = new MyObj(2, "Name 2");
instead of
myObj_2.setName(myObj_1.getName()) etc
do something as following:
myObj_2.copyFrom(myObj_1)
so that they are different instances, but have equal properties.