Section 10.8. Friend Members


10.8. Friend Members

Another 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.




Visual BasicR 2005 for Programmers. DeitelR Developer Series
Visual Basic 2005 for Programmers (2nd Edition)
ISBN: 013225140X
EAN: 2147483647
Year: 2004
Pages: 435

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net