#[std]
struct Date {
let month: num,
day: num,
year: num;
fn new(month: num, day: num, year: num) -> Date {
return [month, day, year]
}
fn birthday() -> Date {
return Date::new(5, 14, 2002)
}
fn tmrw(self: &Date) -> Date {
return Date::new(self->month, self->day + 1, self->year);
}
fn print(self: &Date) {
prn!(self->month); prc!('/');
prn!(self->day); prc!('/');
prn!(self->year);
}
}
struct Test {
let n: num;
fn new(n: num) -> Test { return n as Test; }
fn print(self: &Test) {
prs!("test: "); prn!(self->n); prend!();
}
}
fn test() {
let bday: Date = Date::birthday();
bday.print(); prend!();
((bday.tmrw()).tmrw()).print(); prend!();
let t: Test = Test::new(5);
t.print();
}
fn main() -> void {
for (let i=0; i<10; i=i+1) {
test();
prn!(i); prend!();
}
}