rust/src/test/run-pass/traits-default-method-trivial.rs

19 lines
256 B
Rust
Raw Normal View History

2012-08-13 13:11:09 -05:00
trait Cat {
fn meow() -> bool;
fn scratch() -> bool;
fn purr() -> bool { true }
}
impl int : Cat {
fn meow() -> bool {
self.scratch()
}
fn scratch() -> bool {
self.purr()
}
}
fn main() {
assert 5.meow();
}