by za3faran · 1mo ago · 0 comments
if (obj instanceof Point(double x, double y)) {
foo(x,y)
}
Kotlin with its smart cast feature lets you do if (obj is Point) {
foo(obj.x, obj.y);
}if (obj instanceof Point p) {
foo(p.x(), p.y());
}