面试题答案
一键面试struct Point {
x: i32,
y: i32,
}
impl std::ops::Neg for Point {
type Output = Point;
fn neg(self) -> Point {
Point {
x: -self.x,
y: -self.y,
}
}
}
struct Point {
x: i32,
y: i32,
}
impl std::ops::Neg for Point {
type Output = Point;
fn neg(self) -> Point {
Point {
x: -self.x,
y: -self.y,
}
}
}