Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Point[T <: Number](val x:T, val y:T) {
- def + (other : Point[T]) : Point[T] = new Point[T] ( x + other.x, y + other.y)
- def - (other : Point[T]) : Point[T] = new Point[T] ( this.x - other.x, this.y - other.y)
- def unary_ : Point[T] = new Point[T](-this.x, -this.y)
- def == (other : Point[T]) : Boolean = (this.x == other.x && this.y == other.y)
- def != (other : Point[T]) : Boolean = !(this == other)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement