]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/max-min-classes.rs
`m1!{...}` -> `m1!(...)`
[rust.git] / src / test / run-pass / max-min-classes.rs
1 trait Product {
2     fn product() -> int;
3 }
4
5 struct Foo {
6     x: int;
7     y: int;
8 }
9
10 impl Foo {
11     fn sum() -> int {
12         self.x + self.y
13     }
14 }
15
16 impl Foo : Product {
17     fn product() -> int {
18         self.x * self.y
19     }
20 }
21
22 fn Foo(x: int, y: int) -> Foo {
23     Foo { x: x, y: y }
24 }
25
26 fn main() {
27     let foo = Foo(3, 20);
28     io::println(fmt!("%d %d", foo.sum(), foo.product()));
29 }
30