Skip to content

Instantly share code, notes, and snippets.

@ALSchwalm
Last active July 20, 2019 07:28
Show Gist options
  • Save ALSchwalm/b43986e11db2d864ee9adf090dedfa45 to your computer and use it in GitHub Desktop.
Save ALSchwalm/b43986e11db2d864ee9adf090dedfa45 to your computer and use it in GitHub Desktop.
struct CloningLab {
subjects: Vec<Box<Mammal>>,
}
trait Mammal {
fn walk(&self);
fn run(&self);
}
#[derive(Clone)]
struct Cat {
meow_factor: u8,
purr_factor: u8
}
impl Mammal for Cat {
fn walk(&self) {
println!("Cat::walk");
}
fn run(&self) {
println!("Cat::run")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment