From: Kyle Schmitt Date: 2008-09-26T00:41:18+09:00 Subject: Re: Getting the right class with inheritance and super() On Thu, Sep 25, 2008 at 9:51 AM, Robert Klemme wrote: > Since I would recommend using delegation instead of inheritance you > don't have to. If you use inheritance you must make sure that your > class's invariant is not broken. Upon thinking about it more, and attempting to flush it out in the inheritence direction, I'm coming to agreement about encapsulate instead. >> I'd like it to. This was a first blush since I needed (more wanted, >> but anyway) it in this project. > > If you think about it for a moment you'll realize that your > FixesSizedArray is far from usable in every place where an Array is > used. Just think about algorithms that rely on collecting arbitrary > many objects in an Array (e.g. File.readlines) - you cannot use your > FixedSizedArray there. I agree that it can't be used everywhere, but where I want to use it, I want it to look and feel very much like an array. However, the case of File.readlines may be an example of exactly how I'd like to use it: it gives you a fixed amount of data. f=FixedSizeArray.new(100) f<