[Gambas-user] class enumeration help

Robin Thompson robane00 at ...67...
Wed Apr 30 23:08:08 CEST 2008


Hi,

As part of a project I would like to enumerate symbols of user defined class.

code:
tst1.class
' Gambas class file
PUBLIC aan AS Integer
PUBLIC ban AS String
PUBLIC can AS Float

PUBLIC SUB Main()
DIM test1 AS NEW tst1
DIM st AS String

test1.aan = 1
test1.ban = "hello"
test1.can = 1.1

PRINT #File.out, "aan: " & test1.aan
PRINT #File.out, "ban: " & test1.ban
PRINT #File.out, "can: " & test1.can

WITH Object.Class(test1)
FOR EACH st IN .Symbols
PRINT #File.out, st & ": " & Object.Class(test1)[st].Value
NEXT
END WITH

END

Obviously (hopefully!) the output i would expect is:
aan: 1
ban: hello
can: 1.1
aan: 1
ban: hello
can: 1.1

However i am in fact getting this:

aan: 1
ban: hello
can: 1.1
aan:
ban:
can:

Where am I going wrong?

Thanks for your help,

RT

_________________________________________________________________
Play the Andrex Hello Softie Game & win great prizes 
http://www.thehellosoftiegame.co.uk



More information about the User mailing list