As I already said in my comments, don't create multiple Word
instances for the same word in the document. So, regarding your comment: There never would be a w1
and w2
for a single physical word in the document. There only would be w
.
Example:
var w = new Word(2, 3, "age", 1)
var mention1 = new Mention(w);
var mention2 = new Mention(w);
mention1.UpdateWord(); // sets the fourth property of w to 3
mention2.PrintWord(); // prints (2, 3, "age", 3)
This works, because both Mention
instances work on the same Word
instance.