Let\'s assume I have classes A
, B
, and C
where class C
has readable and writable properties:
public class
Yes it is, but you have to go through some gyrations.
public interface Incrementable {
public void increment();
}
public interface Readable {
public int getScore();
}
public class C implements Incrementable, Readable
{
...
}
Now when you define the method in A that receives a reference to a B
instance, define that method to take an Incrementable
instead. For B
, define it to take a Readable
.