2012-12-10 11:58:37 -08:00
|
|
|
struct S {
|
|
|
|
x: ~str
|
|
|
|
}
|
|
|
|
|
2013-02-26 17:47:41 -08:00
|
|
|
pub impl S {
|
2012-12-10 11:58:37 -08:00
|
|
|
fn foo(self) {
|
2013-02-15 02:44:18 -08:00
|
|
|
self.bar();
|
2012-12-10 11:58:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn bar(self) {
|
2013-05-24 19:35:29 -07:00
|
|
|
println(self.x);
|
2012-12-10 11:58:37 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2012-12-10 11:58:37 -08:00
|
|
|
let x = S { x: ~"Hello!" };
|
|
|
|
x.foo();
|
|
|
|
}
|