C # and VB.Net have the concept of friend assemblies , where these assemblies can access the internal members of the specified assembly. This allows you to provide temporary access to specific callers; this is checked at compile time.
Only assemblies that you explicitly specify as friends can access Friend types and members (Visual Basic) or internal (C #). For example, if assembly B is a friend of assembly A and the assembly of C references in assembly B, C does not have access to the companion (Visual Basic) or internal (C #) types in A.
The reality is that for this function, the use of legitimate capabilities is limited (in these languages, at least), if you are not developing smelly code.
But, having said this, the idea of a class that determines who can name it borders on a violation of the encapsulation and abstraction rules of OOP. By letting the class designate who it can be, you allow the class to have knowledge outside of its realm, and you throw a good design out of the window. A class can dictate how the caller should call, but not which he should call.
Hope this helps - I personally look forward to receiving answers from more academic, language-oriented people.
source share