1
Fork 0
rust/tests/ui/traits/default-method/trivial.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
306 B
Rust
Raw Normal View History

//@ run-pass
2012-12-17 14:57:37 -08:00
2012-08-13 11:11:09 -07:00
trait Cat {
fn meow(&self) -> bool;
fn scratch(&self) -> bool;
fn purr(&self) -> bool { true }
2012-08-13 11:11:09 -07:00
}
impl Cat for isize {
fn meow(&self) -> bool {
2012-08-13 11:11:09 -07:00
self.scratch()
}
fn scratch(&self) -> bool {
2012-08-13 11:11:09 -07:00
self.purr()
}
}
pub fn main() {
2013-03-28 18:39:09 -07:00
assert!(5.meow());
2012-08-13 11:11:09 -07:00
}