[Gambas-user] How do I override an Array class?

tobi tobiasboege01 at ...1601...
Sun Jun 17 13:45:00 CEST 2012


On Sun, 17 Jun 2012, Bruce wrote:
> I would like to override the Variant[] class to extend it with a small
> set of special interest methods.
> 
> The gambas IDE complains when I try to call my class "Variant[]".
> 
> I cannot find anything in the help that seems to preclude this, apart
> from the class naming rules.
> 
> Is this possible?
> 
> 
> (More detail:  I am trying to restructure a large parsing project that
> works with hundreds of arrays of tokens, there is a huge amount of
> redundant code in it that repeats the same operations on the array.
> What I first tried doing was creating a class that inherits Variant[]
> and adds a few of the required methods, called "MyVariant". Then going
> through the parser project and replacing each As Variant[] with As
> MyVariant.  This has raised a problem (of my own making!) where the
> classes in the parser inherit others in the project, I need to change
> the declarations in each inheritance chain in a single step.  This makes
> it fairly difficult to isolate each use of the redundant code and change
> it to use the standardised code in MyVariant.
> So, I figured that if I could just override the Variant[] class then I
> could work on one of the parser classes at a time, clean it up and move
> on and not be bugged by the continual compile/fix/compile/fix cycles I
> am causing while not even getting far with the real goal.)
> 
> Bruce
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

I have done overriding Variant[] successfully (extended it by a specific Sort() method) but it
caused an interpreter complaint (I do not use the IDE) until (excluding) rev #4715 so it would be
interesting what message you get and what revision you use... (and maybe what the critical code
looks like)

Regards,
Tobi




More information about the User mailing list