Skip to content

Instantly share code, notes, and snippets.

@MarkJr94
Last active December 23, 2015 10:39
Show Gist options
  • Save MarkJr94/6622933 to your computer and use it in GitHub Desktop.
Save MarkJr94/6622933 to your computer and use it in GitHub Desktop.
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