Never mind, I got it:

(define baz%
  (class object%
    (init (foo 0))
    (define bar foo)
    (super-new)
    (define/public (get-bar)
      bar)
    (define/public (copy-baz)
      (new baz% [foo (+ (get-bar) 2)]))))

> (define a (new baz%))
> (send a get-bar)
0
> (define b (send a copy-baz))
> (send b get-bar)
2

In hind-sight, I don't know why it wasn't obvious to me at the time.

Best regards,
-Steve

--  
Steve Byan
steveb...@me.com
Littleton, MA



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to