mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +00:00
19 lines
263 B
Rust
19 lines
263 B
Rust
//@ run-pass
|
|
|
|
|
|
trait Cat {
|
|
fn meow(&self) -> bool;
|
|
fn scratch(&self) -> bool { self.purr() }
|
|
fn purr(&self) -> bool { true }
|
|
}
|
|
|
|
impl Cat for isize {
|
|
fn meow(&self) -> bool {
|
|
self.scratch()
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
assert!(5.meow());
|
|
}
|