Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Como puedo librarme de la referencia circular? (https://www.clubdelphi.com/foros/showthread.php?t=28098)

Lionheart 09-12-2005 00:52:19

Como puedo librarme de la referencia circular?
 
Hola.Como puedo hacer para librarme de la referencia circular si quiero llamar desde una unidad a procedimientos de objetos q estan en la otra unidad y viceversa.Gracias

dec 09-12-2005 01:23:43

Hola,

Si estás referenciando a una unidad en la cláusula "uses" de la interfaz de otra, aquélla no podrá referenciar a esta en su cláusula "uses" de la interfaz. La solución está en mover a la cláusula "uses" de la implementación una de las dos referencias. Lo siguiente está extraído del apartado "Circular unit references" y es un extracto (casi completo):


Cita:

Empezado por Ayuda de Delphi
In the simplest case of two mutually dependent units, this means that the units cannot list each other in their interface uses clauses. So the following example leads to a compilation error:

Código Delphi [-]
unit Unit1;
interface
uses Unit2;
Código Delphi [-]
unit Unit2;
interface
uses Unit1;
However, the two units can legally reference each other if one of the references is moved to the implementation section:

Código Delphi [-]
unit Unit1;
interface
uses Unit2;
Código Delphi [-]
unit Unit2;
interface
{...}
implementation
uses Unit1;
{...}
To reduce the chance of circular references, it's a good idea to list units in the implementation uses clause whenever possible. Only when identifiers from another unit are used in the interface section is it necessary to list that unit in the interface uses clause.


Lionheart 13-12-2005 13:58:33

Hola.Ya probe lo que me dijiste y me funciona.Gracias por la ayuda.


La franja horaria es GMT +2. Ahora son las 21:48:12.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi