[Gambas-user] Gambas bug?

Fabián Flores Vadell fabianfloresvadell at ...626...
Sat Feb 11 00:33:25 CET 2012


2012/2/10 Emil Lenngren <emil.lenngren at ...626...>

> So what you want is to extend the array class with some extra methods?
> Just use
> Inherits Person[]
> in the PersonList class ;)
>

Did you read the code and comments?

Not at all. I don't want use inheritance because I won't all methods and
properties from Array[] in the PeopleList interfaz. Hence, I have to use
aggregation (composition, delegation).

If I use inheritance, the clients of PeopleList could do bad things or
things that have no sense (as the case), e.g.

PeopleList.Fill
PeopleList.Push
PeopleList.Pop

This isn't the best example. But if you think about a minute, you will
catch it.

Do not focus on the example, because really, what I want isn't to add to a
class methods from an array (that's just an example). I looking for a
design pattern that allows me to solve a typical problem.

That problem could be described as "How to add methods from a helper object
without have to rewrite a wrapper for each method (with just a call within)
in the host class?".

-- 
Fabián Flores Vadell
www.comoprogramarcongambas.blogspot.com
www.speedbooksargentina.blogspot.com



More information about the User mailing list