how to make private class member private

Tony tonytdominguez at aol.com
Sun Mar 18 21:25:11 UTC 2018


On Sunday, 18 March 2018 at 18:04:13 UTC, Tony wrote:
> On Tuesday, 13 March 2018 at 06:03:11 UTC, Mike Parker wrote:
>
>>
>> D is not C++, C#, or Java. C++ uses friend to get around the 
>> issue. Java has no solution. I don't know about C#.
>>
>
> Java has four protection levels. If you don't explicitly 
> specify [private, protected, public] the protection level is 
> implicitly "package-private". That means that any class in the 
> same package can access that attribute. I believe that Java 
> packages are identical to D packages.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/accessibility-levels

C# has 6 accessibility levels:

public - Access is not restricted.
protected - Access is limited to the containing class or types 
derived from the containing class.
private - Access is limited to the containing type.
internal - Access is limited to the current assembly.
protected internal - Access is limited to the current assembly or 
types derived from the containing class.
private protected - Access is limited to the containing class or 
types derived from the containing class within the current 
assembly. Available since C# 7.2.

What is a C# Assembly? Someone says on a forum:
"An assembly is a "unit of deployment" for .NET, almost always a 
.exe or .dll.
In C# terms, it's basically a single C# project."

And also refers to
https://social.msdn.microsoft.com/Forums/en-US/088ce8ed-ef9b-4dea-88b3-ca016885e26d/what-is-an-assembly-in-terms-of-c?forum=csharplanguage
which says:
"Assemblies are the building blocks of .NET Framework 
applications; they form the fundamental unit of deployment, 
version control, reuse, activation scoping, and security 
permissions. An assembly is a collection of types and resources 
that are built to work together and form a logical unit of 
functionality. An assembly provides the common language runtime 
with the information it needs to be aware of type 
implementations. To the runtime, a type does not exist outside 
the context of an assembly."



More information about the Digitalmars-d-learn mailing list