Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: HIDDEN a property is unusable
Message
De
23/02/2005 03:57:30
 
 
À
23/02/2005 03:39:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00987841
Message ID:
00989522
Vues:
40
>Hi Fabio,
>
>I really appreciate your addiction to pure OOP.
>
>Okay, so while VFP lacks the real OOP style it has many advantages for RAD which I wouldn't want to throw away. Some of them are, that you can work both the OOP way and with procedural code.

This does not have null to that to make with RAD or the procedural face of VFP.
The VFPT can fix the bug without to lose some benefit from VFP.

>
>A workaraound for your problem may be something like this:
>
>The idea is to have an interface class (or bridge pattern) to the real class, exposing only those properties and methods you want to be public. This interface class instanciates the real class wanted as a hidden property and redirects calls to the class. Then you have no need to define a hiddenproperty hidden, simply don't define it in the interface class.
>
>
>CLEAR
>ON ERROR ? MESSAGE()
>WITH CREATEOBJECT("Interface","SuperClass")
>	.CALL
>ENDWITH
>?
>WITH CREATEOBJECT("Interface","subClass")
>	.CALL
>ENDWITH
>ON ERROR
>
>DEFINE CLASS Interface as container
>    HIDDEN oClass
>
>    PROCEDURE Init
>       LPARAMETERS tcClass
>
>       This.oClass=CREATEOBJECT(tcClass)
>    ENDPROC
>
>    PROCEDURE Call
>       RETURN this.oClass.Call()
>    ENDPROC
>ENDDEFINE
>
>
>DEFINE CLASS SuperClass as Interface
>	hiddenproperty = 1
>	
>	PROCEDURE Init()
>	  *
>	ENDPROC
>
>	PROCEDURE call
>		? "SuperClass CALL hiddenproperty IS PUBLIC HERE"
>		? this.hiddenproperty
>        this.hiddenproperty = 3
>		? this.hiddenproperty
>	ENDPROC
>ENDDEFINE
>
>DEFINE CLASS subClass as SuperClass
>	hiddenproperty = 2	
>	* no need for hidden, as the interface is instanciated
>	* and the interface doesn't show that property
>	* HIDDEN hiddenproperty
>ENDDEFINE
>
>
>Instead of rediricting the call in each method of the interface class , you may use BINDEVENTS in the init of "Interface" to bind all calls of THIS... to THIS.oClass...
>And properties of interface should have an assign-method storing their value both in THIS and THIS.oClass.
>
>Bye, Olaf.

VFP have the "Control" baseclass for do this.

But with this logic,
it is not possible to supply classes to third parts with public properties,
why if someone redefines they hidden the class methods goes in crisis.

Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform