2013-01-22 19:20:08 -06:00
|
|
|
struct SpeechMaker {
|
|
|
|
speeches: uint
|
|
|
|
}
|
|
|
|
|
2013-02-26 19:47:41 -06:00
|
|
|
pub impl SpeechMaker {
|
2013-03-22 13:23:21 -05:00
|
|
|
fn how_many(&const self) -> uint { self.speeches }
|
2013-01-22 19:20:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(speaker: &const SpeechMaker) -> uint {
|
|
|
|
speaker.how_many() + 33
|
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2013-01-22 19:20:08 -06:00
|
|
|
let mut lincoln = SpeechMaker {speeches: 22};
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(foo(&const lincoln), 55);
|
2013-01-22 19:20:08 -06:00
|
|
|
}
|