Skip to content

Instantly share code, notes, and snippets.

@zmack
Last active August 29, 2015 14:11
Show Gist options
  • Save zmack/52357e63459840f8da72 to your computer and use it in GitHub Desktop.
Save zmack/52357e63459840f8da72 to your computer and use it in GitHub Desktop.
impl Operation for Bar {
fn add(&self, other: int) {
}
}
impl OtherOperation for Bar {
fn zero(&self) -> uint {
0
}
}
pub trait Operation {
fn zero(&self) -> uint;
fn add(&self, other: int);
}
pub trait OtherOperation: Operation {
fn one(&self) -> uint {
self.zero() + 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment