From: gabriele renzi Date: 2005-05-23T03:40:17+09:00 Subject: Re: Uniform vector class, inheriting from Array: How to make sure that methods return a Vector and not an Array? Brian Schr�der ha scritto: > > I'm quite shure you don't need to do what you are doing, because this > violates duck typing, but if you really want to you can use something > like the below. > > Here I don't inherit from an array, but forward to an array, which > often is the simpler approach. this makes me think: the delegation approach is usually simpler. But is this because of an underlying fault of the inheritance mechanic or is it the obvious more simple thing? I've often thought that there must be a better way of handling this "generative" methods like "+" (but, say, a polymorphic #map could be the same) which make subclassing harder, has someone haver thought the same? Is there something in other languages that allow to overcome this kind of limitations?