Permalink
Browse files

Specialized vs non-specialized

  • Loading branch information...
1 parent c53b51d commit b3eeb3746745aeb3c806d395d552cf6a5ae2efef Amos Wenger committed Jun 7, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 samples/jar.ooc
View
@@ -2,15 +2,24 @@
Jar: class <X> {
cookie: X
- doStuff: func (.cookie) {
+ //ostracize: func (=cookie) { }
+ ostracize: func (cookie: X) {
+ this cookie = cookie
}
+
+ getCookie: func -> X { cookie }
}
#specialize Jar<Char> // binks
main: func {
j := Jar<Int> new()
- j doStuff(42)
+ j ostracize(99)
+ printf("j's cookie = %d\n", j getCookie())
+
+ k := Jar<Char> new()
+ k ostracize('c')
+ printf("k's cookie = %d\n", k getCookie())
}

0 comments on commit b3eeb37

Please sign in to comment.