rust/src/test/run-pass/obj-recursion.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

20 lines
278 B
Rust

type adder =
obj {
fn add();
};
obj leaf_adder(x: int) {
fn add() { log "leaf"; log x; }
}
obj delegate_adder(a: adder) {
fn add() { a.add(); }
}
fn main() {
let x = delegate_adder(delegate_adder(delegate_adder(leaf_adder(10))));
x.add();
}