2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2012-12-10 17:32:48 -08:00
|
|
|
|
2012-08-14 10:00:31 -07:00
|
|
|
|
|
|
|
trait Cat {
|
2013-05-08 13:15:08 +09:00
|
|
|
fn meow(&self) -> bool;
|
|
|
|
fn scratch(&self) -> bool { self.purr() }
|
|
|
|
fn purr(&self) -> bool { true }
|
2012-08-14 10:00:31 -07:00
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
impl Cat for isize {
|
2013-05-08 13:15:08 +09:00
|
|
|
fn meow(&self) -> bool {
|
2012-08-14 10:00:31 -07:00
|
|
|
self.scratch()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-03-28 18:39:09 -07:00
|
|
|
assert!(5.meow());
|
2012-08-14 10:00:31 -07:00
|
|
|
}
|