Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
Class Scope in same unit |
Sat, Oct 10 2015 7:20 AM | Permanent Link |
Christian Kaufmann | In Delphi there is a special rule that classes in the same unit are "friend". Since some years you
can limit this by using the keyword "strict". I did test that in EWB and it seems, that "private" is "strict private", but "protected" methods are "friend". Are these the EWB rules or is one of both an error? cu Christian |
Sat, Oct 10 2015 12:01 PM | Permanent Link |
Raul Team Elevate | On 10/10/2015 7:20 AM, Christian Kaufmann wrote:
> I did test that in EWB and it seems, that "private" is "strict private", but "protected" methods > are "friend". > Are these the EWB rules or is one of both an error? Strict "private" looks right and is as per manual. "Protected" as per manual should not be visible to another class in the same unit (that is not an descendant) so need Tim to chime in on this one as I'm seeing this as well: - ClassA (based on TObject) protected member "x" can be accessed by classB (also based TObject) procedure as long as they are in the same unit. Once you move ClassA to another unit compiler picks it up as "[Error] main.wbs (61,12): The referenced variable, parameter, or function x does not exist". I have a feeling it might be needed for the IDE aspects Tim - if you're looking at Scope page in manual i think the 2nd sample code section that says "TClassB = class(TClassB)" should be "TClassB = class(TClassA)" Raul |
Sat, Oct 10 2015 12:27 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Christian,
<< Are these the EWB rules or is one of both an error? >> Yes, those are the rules. In addition, there is one other change with the protected scope: any descendant classes can access the protected scope of any *common* ancestor class. For example, the Element property is in the protected scope of the TInterfaceController class. This means that *any* TInterfaceController descendant class can access the Element property of any other class that *also* descends from TInterfaceController. In effect, this makes the property public to the two different descendants because they share the same ancestor. Tim Young Elevate Software www.elevatesoft.com |
Sat, Oct 10 2015 12:27 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Raul,
<< Tim - if you're looking at Scope page in manual i think the 2nd sample code section that says "TClassB = class(TClassB)" should be "TClassB = class(TClassA)" >> Fixed it, thanks. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, January 18, 2025 at 08:56 AM | Privacy PolicySite Map © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |