Is there any way to create dynamically an extended anonymous instance given another one? Would be something like this, and I think it would be great.
File myFile = new File("notes.txt");
new FileWrapper extends myFile(){ //instance!!!
@Override public boolean equals(File in){ return false;}
};
This is like copying the object instance and rewritting the logic inside a particular method If not whats the best way of achieving it?
Note: I know that the example is valid if myFile is a class´s name and not and instance, but then I should do something to hold the instances vars and inner info.