ven. 15 juillet 2011, 10h57
Jean à Grenoble
atoutfox.public.association
Re: écriture une méthode qui initialise une propriété de type tableau...
Et si, au lieu de créer un tableau, tu crées une classe ?
DEFINE CLASS tableau AS custom && jme 15/07/2011
* on définit un tableau avec quelques paramètres
nblignes = 1
nbcolonnes = 1
DIMENSION tableau(1,1)
PROCEDURE Init(pnlignes AS Number, pncolonnes AS Number)
This.nblignes = m.pnlignes
This.nbcolonnes = m.pncolonnes
IF This.nblignes > 0
IF This.nbcolonnes > 0
* tableau à 2 dimensions
DIMENSION This.tableau(This.nblignes, This.nbcolonnes)
ELSE && This.nbcolonnes > 0
* tableau à 1 dimension
DIMENSION This.tableau(This.nblignes)
ENDIF && This.nbcolonnes > 0
ELSE && This.nblignes > 0
STORE 0 TO This.nblignes, This.nbcolonnes && on 'signale' l'erreur
ENDIF && This.nblignes > 0
ENDPROC && Init
ENDDEFINE && tableau
J'ai un exemple d'utilisation dans le prg joint ...
C'est pas de l'OOP çà ?
A+
Jean à Grenoble
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000006438