Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

Circular class reference Find similar branches


oomneeq   (2001-12-14 21:26) [0]

Such a problem
T1 = class
F: T2;
end;
T2 = class
F: T1;
end;
so solved
T2 = class;
T1 = class
F: T2;
end;
T2 = class
F: T1;
end;
Question: Is there a solution for the case when the classes T1 and T2
located in different unit "ah?
I can't do something: <



Иван Шихалев   (2001-12-14 22:03) [1]

Of course not. What for?

You can only declare an ancestor of T2 in scope for T1.



oomneeq   (2001-12-17 12:00) [2]

A question generally not idle.
It would be desirable, that classes had mutual links against each other, but for some reasons cannot be placed in one module - they are TForm.
While I do this through an intermediary - a class that knows both,
and each of them knows him. Through this intermediary, they access each other.
Throw a little idea of ​​direct acquaintance of the above classes.
Well, at least hint where to dig :)



Fellomena   (2001-12-17 12:36) [3]

I can not say exactly how it can be done in Delphi, but in C ++ there is such a thing as friendly classes,
those. classes declared as friendly have access to all fields (methods?) of another class, even those
in Privat section described. I know that in Delphi all classes located in one unit are considered friendly, but here’s how
do the same for different units ???




Иван Шихалев   (2001-12-17 19:17) [4]

The problem is that classes should be described in the section interface (by the way, access to private fields, like b, was not discussed), and circular references in this section are strictly prohibited. The most correct way:

unit Unit1; interface uses ; ; type TForm1 = class (TForm) fldForm2: TForm; procedure doSomeThing; end ; implementation uses Unit2; procedure TForm1.doSomeThing; begin (fldForm2 as TForm2) .TForm2OnlyProperty: = AnyValue; fldForm2.TFormProperty: = AnotherValue end ; end .

And quite similarly - Unit2, only one and two places change places.



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top





Memory: 0.56 MB
Time: 0.028 c
14:22369
Victor Tsay
2001-11-08 09:11
2002.01.08
How in the Delphi editor to shift blocks of text?


4:22456
Redmax
2001-11-01 11:10
2002.01.08
COM NetMeeting Objects


1:22077
Type
2001-12-18 17:19
2002.01.08
Question to pascalshchik ???


1:22260
Alex_Sudakov
2001-12-17 15:28
2002.01.08
Tell me, is there a DsgnIntf ​​unit in D6?


1:22016
Leviathan
2001-12-13 23:05
2002.01.08
Appearance form





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish