PasteRack.org
Paste # 32136
2015-03-27 20:07:29

Forked from paste # 82631.

Fork as a new paste.

Paste viewed 348 times.


Embed:

private init field

  1. #lang racket
  2.  
  3. (define fish%
  4.   (class object%
  5.     (init ([a-color color]))
  6.  
  7.     (define color a-color)
  8.  
  9.     (super-new)
  10.  
  11.     (define/public (get-color)
  12.       color)))
  13.  
  14. (define a-fish (new fish% [color "blue"]))

=>