From e4a3b9ac699168ae536b79422141e5fa923369b2 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 8 Jul 2012 01:12:43 -0700 Subject: [PATCH] tutorial: Fill out bounded type test case --- doc/tutorial.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/tutorial.md b/doc/tutorial.md index aadcfe024f6..ccb22c5b5cd 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2507,10 +2507,15 @@ values of *an* unknown type that conforms to a given interface. However, consider this function: ~~~~ +# type circle = int; type rectangle = int; # iface drawable { fn draw(); } +# impl of drawable for int { fn draw() {} } +# fn new_circle() -> int { 1 } fn draw_all(shapes: ~[T]) { for shapes.each |shape| { shape.draw(); } } +# let c: circle = new_circle(); +# draw_all(~[c]); ~~~~ You can call that on an array of circles, or an array of squares