;;定义一个类必须在类名字后面加%,这个是Scheme语法规定 object%是超类
(define email% (class object%
(init to from)
(define To to)
(define From from)
(super-new)
(define/public (send) (display From))
(define/public (receviver) (displayer To))
(define/public (change-sender new-sende-name)
(set! From new-sende-name))))
(define email-one (new email% (to 'hh) (from 'ss)));;定义第一个email
(define email-two (make-object email% 'fg 'bb));; 定义第二个,make-object 创建一个对象!
(send email-one sender) ;;发送第一个
(send email-two sender);;发送第二个
(send email-one change-sender 'xxxxx);;重新定义第一个
2010年5月29日星期六
订阅:
博文评论 (Atom)
没有评论:
发表评论