1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
mod kitties { class cat { priv { let mut meows : uint; } let how_hungry : int; new(in_x : uint, in_y : int) { self.meows = in_x; self.how_hungry = in_y; } fn speak() { self.meows += 1u; } fn meow_count() -> uint { self.meows } } }