There are two classes ..let us consider class A and Class B. I have created an instance of Class A that is OBJ1 and inside class A have declared few instance variables and methods. The Object state has been changed with lot of method calls to change the instance variables. At this point i am creating an instance of Class B OBJ2 .
With a minimum number of steps have to have the OBJ2 state should be the same as OBJ1 state? How would i acheaive this?
you can do a cloning of obj1 but it will return you Object type and from there you can only take back object of ClassA type by downcasting it to type ClassA. doncasting to ClassB will through a ClassCasteException at runtime. i dont see any way, if you find please let me know also
thanks,<br />gaurav abbi
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database