Last active: 2 years ago
#[derive(Debug)]
struct Ractangle {
widht: u32,
height: u32,
}
impl Ractangle {
fn new(widht: u32, height: u32) -> Self {
Self { widht, height }
}
fn can_hold(&self, target: &Ractangle) -> bool {
self.widht > target.widht && self.height > target.height
}
}
fn main() {
let my_ract = Ractangle::new(42, 42);
println!("My ract: {:?}", my_ract);
let target_ract = Ractangle::new(32, 43);
println!(
"My ract can hold target_ract: {}",
my_ract.can_hold(&target_ract)
);
}