[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

abstract classes?



Hi all,

Does PLT Scheme have an equivalent to an abstract
class?

I have an interface I want to implement with a base
class and two derived classes.  I want to implement
most of the functions in the base class, and a few
functions in the derived classes.  The base class
won't satisfy the interface as is, but the derived
classes will.  Can the base class then implement the
interface?  In Java this would be require the base
class to be declared abstract.

To make things concrete:

;; The interface
  (define test-run<%>
    (interface ()
      test
      result
      ->string))
  
;; The base class
;; Doesn't implement ->string
  (define test-run%
    (class* object% (test-run<%> (test-case
test-result)
      (private
	[the-test test-case]
	[the-result test-result])
      (public
	[test (lambda () the-test)]
	[result (lambda () the-result)])
      {sequence (super-init)}))

Thanks,
Noel

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/