# OBJECT expressing inheritance
# counter-container adds one method to container: count
[hear] (define counter-container
(lambda (x)
(let ((super (container new)))
(reflective
(lambda (self msg)
(cond ((= (msg) counter-container) (self))
((= (msg) count) (list-length (super inventory)))
(super (msg))))))));
[hear] (define cc1 (counter-container new));
[hear] (= 0 (cc1 count));
[hear] (cc1 add 4);
[hear] (= 1 (cc1 count));
[hear] (cc1 add 5);
[hear] (= 2 (cc1 count));