rust/src/test/run-pass/default-method-simple.rs

24 lines
240 B
Rust
Raw Normal View History

trait Foo {
fn f() {
io::println("Hello!");
self.g();
}
fn g();
}
struct A {
x: int
}
impl A : Foo {
fn g() {
io::println("Goodbye!");
}
}
fn main() {
let a = A { x: 1 };
a.f();
}