2013-01-22 19:20:08 -06:00
|
|
|
struct SpeechMaker {
|
|
|
|
speeches: uint
|
|
|
|
}
|
|
|
|
|
2013-05-31 17:17:22 -05:00
|
|
|
impl SpeechMaker {
|
|
|
|
pub 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
|
|
|
}
|