The 'internal' keyword.
A nagging doubt.
Why is there a need for access modifier named 'internal' in C# which is partially
borrowed from Java keyword "Protected"(Java is kind of confusing clubbing
access to derived classes and package classes!).
Apart from the literal meaning , that it can be accessed by types in the
same assembly or Package(Java) , can somebody suggest a situation where the
addition of this keyword to C# language has justification.
Me coming from C++ style of coding I can think this keyword as near to 'friend
' keyword. But the keyword friend is used specifically by the class implementor/designer
and has control over which classes to allow access. While in case of 'internal'
the control shifts to the assembly/package designer as which classes has
access depends on the classes inside the assembly/package. Why did the drafters
of Java and C# language specification think of this as a nice idea?
I can also give a parallel in 'C'. The keyword 'static' which restricts the
scope of the variable/method to the file in which the method or variable
is declared. Were they thinking about this when they thought of the keyword
Is there anything similar to friend keyword in C# where I can limit access
to only a certain set of classes and not all classes in the assembly.
Please do not confuse with friend keyword in VB.NET. That is similar to the
Thanks in advance
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL