I have interface Syncable:
public interface Syncable{
public void sync(Syncable other);
}
And two implemented classes:
public class TstA implements Syncable{
@Override
public void sync(Syncable other) {
// TODO Auto-generated method stub
}
}
public class TstB implements Syncable{
@Override
public void sync(Syncable other) {
// TODO Auto-generated method stub
}
}
So this code is legal:
TstA a = new TstA();
TstB b = new TstB();
a.sync(b);
This is not what I want. I want to allow a.sync receive instances of TstA, and b.sync receive instances of TstB.
Probably I have to use generics, but how?