Last active
December 23, 2015 10:39
-
-
Save MarkJr94/6622933 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
trait Plode { | |
fn explode(&mut self) -> ~str { | |
~"Boom" | |
} | |
fn implode(&mut self) -> ~str { | |
~"Pop" | |
} | |
} | |
impl Plode for int { | |
fn explode(&mut self) -> ~str { | |
~"Boom(int)" | |
} | |
fn implode(&mut self) -> ~str { | |
~"Pop(int)" | |
} | |
} | |
fn main() { | |
let mut obj = ~5 as ~Plode; | |
println(obj.explode()); | |
println(obj.implode()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment