[Newbies] Collection subclasses
Rob Rothwell
r.j.rothwell at gmail.com
Thu Apr 3 02:52:35 UTC 2008
On Wed, Apr 2, 2008 at 10:48 PM, Randal L. Schwartz <merlyn at stonehenge.com>
wrote:
> >>>>> "Rob" == Rob Rothwell <r.j.rothwell at gmail.com> writes:
>
> Rob> Is one not supposed to make subclasses of these classes, and if so,
> why not?
>
> Generally, your object "has a" collection, but doesn't qualify to be "is
> a"
> collection. If you really want to subclass collection classes, you need
> to peer deeply inside the existing classes, and do the right thing.
>
> It's much easier to implement your object, throw a collection inside, then
> implement the parts of the collection protocol that you end up using,
> starting
> with #do:, by delegating those to your inside collection.
>
Thanks...I can accept that for now!
So the behavior I am seeing is to be expected, then? And how would I have
known to expect this? I guess my assumption was that any object could
"extend" any other object!
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080402/01177d62/attachment-0001.htm
More information about the Beginners
mailing list