10.8. Friend MembersAnother intermediate level of member access is Friend access. A class's Friend members can be accessed only by code in the same assembly. In a program or an assembly that consists of one class declaration, declaring a member with Friend access has no specific effect. However, if a program uses multiple classes from the same assembly, these classes can access each other's Friend members directly through references to objects of the appropriate classes. Unlike Public access, any other programs that are declared outside the assembly cannot access these Friend members. To access a non-Shared Friend member within the same assembly, you would first have to create an object of the class that declares the Friend member, then invoke the Friend member using the dot (.) separator. You can access a Friend member that is also Shared via the name of the class that declares the Friend member and a dot (.) separator. Note that you can also have Protected Friend members that are accessible both from code in the same assembly and by subclasses of the class in which the Protected Friend members are declared. |