I am trying to backport some code from C# to C++ to get around an annoying problem, and what like to ask if anyone knows what the equivalent of C#’s ‘internal’ would be in C++.
Here’s an example of the it in use:
internal int InternalArray__ICollection_get_Count ()
{
return Length;
}
There is no direct equivalent of
internalin C++. Apart frompublic/protected/privatethe only other access control mechanism isfriend, a mechanism by which can allow specific classes access to all members of your own class.It could therefore be used as an
internal-like access control mechanism, with the big difference being that:friendclasses one by onefriendclasses have access to all members without exception; this is an extremely high level of access and can introduce tight coupling (which is the reason why the customary reflex reaction tofriendis “do you really need that?”)See also When should you use 'friend' in C++?