I think the OP is referring to the ability in C++ to make friend classes. But that is a wild guess and I could be wrong. The OP should clarify.
Yes that's what I need help on.
Well, if so, the answer is pretty simple. VB.NET, C# and .NET have different, somewhat simplified approach. There are no "friends" in the sense of C++. The difference is that .NET introduces the concept of assembly and provides additional distinction in access specifier. Instead of just one
public
specifier, there is one more,
internal
. Likewise, C++
protected
splits in two:
protected
and
internal protected
. The keyword
internal
means "same as "public" but only in the same assembly" and
protected internal
means: "same as "protected" but only in the same assembly".
Back to
internal
: this specifiers makes all types friends to all other code in the same assembly, but inaccessible from external assemblies. This is certainly less fine-grain approach than that of C++, but in practice is only should encourage the developers to use assemblies properly. From the other hand, using C++ "friend" feature is not trivial and not always help developing really tight access control.
It should be noted that access specifiers do not present any security protection, as all types and methods can be accessed using Reflection, even
private
and
protected
ones. The access specifiers are designed to guard discipline of programming, not to protect again malicious activity.
On top of all this, there are also
friend assemblies mentioned by Wonde. Please see his solution for more detail.
—SA