[Gambas-user] A few questions.
Oliver Stieber
oliver_stieber at ...370...
Wed Dec 22 04:16:14 CET 2004
Well, a couple of cups of coffee solved some of my
problems, well with a bit of a hack.
It looks like downcasting works for calling an
inherited method.
' Gambas class file
INHERITS Object[]
PUBLIC SUB add(key AS String, value AS Variant)
DIM aparam AS Object
DIM foo AS Object[]
aparam = NEW parameter(key,value)
'down cast to call the add method on object.
foo=ME
foo.Add(aparam)
end sub
I've just noticed all the reflections stuff, and had
at a class browser for the debugger.. but...
classes["myclass"]["symbol"] errors with not an array
and classes["myclass"]._get("symbol") burns.
> 1: How do I create a type safe array of object and
> pass it as a parameter to a function e.g.
>
> public sub dosomething(optional things as type[] =
> null)
>
>
>
> 2: I've tried a 'work around' of creating a class
> types that inherits object[], I've overridden? the
> add
> function so that I can add a key and value (I know I
> can do this with a collection, but I want to be able
> to get the keys back too)
>
> PUBLIC SUB add(key AS String, value AS Variant)
> DIM aparam AS Object
> aparam = NEW parameter(key,value)
>
> which is find, but how do I call the object[] to add
>
> I've tried add(aPARAM) but it doesn't work...
>
> Also when I try to perform array access on my class
> it
> fails, reporting class is not an array.
>
>
>
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
More information about the User
mailing list