Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nested arrays
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00107969
Message ID:
00107970
Vues:
14
Hi Larry,

Yes an array element can point to another array element. Well... I need to re-phrase that statement. We can make an array element point to another array element.

Arrays can have .null. values and nulls can point to objects, so if your array is defined in an object you can achieve it.

Look at this example:
LOCAL laParent[3]
laParent = .null.
laParent = CREATEOBJECT('ChildArray')
	
DEFINE CLASS ChildArray as line
	DIMENSION aChild[3]
	
	FUNCTION INIT()
		this.aChild = 'Data'
	ENDFUNC
	
ENDDEFINE	

The debugger will show you the way you would want to see the information. Though simply issuing
? laParent[1]	
will return an error because it is an object reference to an array. You might want to wrap your array elements using ISNULL() or TYPE()... just in case you allow a mix of object references and data items.

Interestingly, you could use ACOPY to a variable and it still works the same way.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform