Suppose we have a class
public class Point {
private final int x;
private final int y;
@Override public boolean equals(Object o) {
if (!(o instanceof Point))
return false;
Point p = (Point)o;
return p.x == x && p.y == y;
}
// Remainder omitted
}
and a subclass
public class ColorPoint extends Point {
private final Color color;
// Remainder omitted
}
what are the consequences of NOT implementing equals() method on ColorPoint?
Suppose we have a class
public class Point {
private final int x;
private final int y;
@Override public boolean equals(Object o) {
if (!(o instanceof Point))
return false;
Point p = (Point)o;
return p.x == x && p.y == y;
}
// Remainder omitted
}
and a subclass
public class ColorPoint extends Point {
private final Color color;
// Remainder omitted
}
what are the consequences of NOT implementing equals() method on ColorPoint?
Suppose we have a class
public class Point {
private final int x;
private final int y;
@Override public boolean equals(Object o) {
if (!(o instanceof Point))
return false;
Point p = (Point)o;
return p.x == x && p.y == y;
}
// Remainder omitted
}
and a subclass
public class ColorPoint extends Point {
private final Color color;
// Remainder omitted
}
what are the consequences of NOT implementing equals() method on ColorPoint?
status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|
repetition number in this series | 0 | memorised on | scheduled repetition | ||||
scheduled repetition interval | last repetition or drill |