Last active
July 20, 2019 07:28
-
-
Save ALSchwalm/b43986e11db2d864ee9adf090dedfa45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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