Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Specialized vs non-specialized

  • Loading branch information...
commit b3eeb3746745aeb3c806d395d552cf6a5ae2efef 1 parent c53b51d
@nddrylliog authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 samples/jar.ooc
View
13 samples/jar.ooc
@@ -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())
}
Please sign in to comment.
Something went wrong with that request. Please try again.