2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2012-12-11 01:32:48 +00:00
|
|
|
|
2012-12-17 22:57:37 +00:00
|
|
|
|
2012-08-13 18:11:09 +00:00
|
|
|
trait Cat {
|
2013-03-13 02:32:14 +00:00
|
|
|
fn meow(&self) -> bool;
|
|
|
|
fn scratch(&self) -> bool;
|
|
|
|
fn purr(&self) -> bool { true }
|
2012-08-13 18:11:09 +00:00
|
|
|
}
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
impl Cat for isize {
|
2013-03-13 02:32:14 +00:00
|
|
|
fn meow(&self) -> bool {
|
2012-08-13 18:11:09 +00:00
|
|
|
self.scratch()
|
|
|
|
}
|
2013-03-13 02:32:14 +00:00
|
|
|
fn scratch(&self) -> bool {
|
2012-08-13 18:11:09 +00:00
|
|
|
self.purr()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2013-03-29 01:39:09 +00:00
|
|
|
assert!(5.meow());
|
2012-08-13 18:11:09 +00:00
|
|
|
}
|