Hello,
when moving C# code to X# I have encountered something I don't understand.
AFAIK the "private" statement in C# is to translate to "protected" in X# because "private" has another meaning in xBase.
But the following code does not compiles in X# (Core):
wriedmann wrote:when moving C# code to X# I have encountered something I don't understand.
AFAIK the "private" statement in C# is to translate to "protected" in X# because "private" has another meaning in xBase.
But the following code does not compiles in X# (Core):
Hi,
I think that you cannot use the protected keyword with static classes because they cannot be inherited like normal classes.
See here https://stackoverflow.com/questions/774 ... ic-classes
In my understanding the protected keyword is used to limit the visibility of a variable/method only to derived classes.
HTH
Regards Giuseppe
wriedmann wrote:Hello,
when moving C# code to X# I have encountered something I don't understand.
AFAIK the "private" statement in C# is to translate to "protected" in X# because "private" has another meaning in xBase.
The X# equivalent of PRIVATE is HIDDEN but we also allow PRIVATE. The remark about PRIVATE in the documentation relates to the private STATEMENT and NOT the private visibility MODIFIER for instance variables/fields and methods.
PROTECTED means that a method or field can also be seen by subclasses, but you can't inherit from STATIC classes so that is meaningless for a static class.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu