I have the following problem. Assume we have two instances of the class Assignment. Each instance has a start and an end date. The second assignment starts when the first ends. Now I have some information in the first assignment which is also needed in the second assignment when the first one is expired.
I would need something like a static variable for this both instances, but not static for the whole class.
What is the best way to do this?
Thanks
Matthias
===============EDIT===============
I think my question was not specific enough. I know how to copy data from one into another, but this is not appropriate in this situation.
My assignments are the linking between employees and projects to resolve a n:n relation. But one employee could have several assignments to the same project and I need information which is important for all assignments.
If I update the information in assignment1 this should be updated in all other assignments which connect the employee to this specific project. For performance reasons, I would prefer to change this in one central place and not to copy the information by hand.
===============EDIT===============
I thought about the problem, and I think my problem could be solved if every assignment holds a reference to the information. With this, a change in one of the assignments should automatically be distributed to the others.
===============EDIT===============
Abaddon666 answer and annotation were correct, the remaining question is how to share that reference to all instances of assignment in a proper way. We solved it in such a way, that we use a table in the DB where we store the information with two foreign keys and load the information for an employee and for a specific project when it is needed. I will accept Abaddon666 answer, but maybe there is a better solution as the current one.