I have one class that is used as a low-level utility class by other
classes in the same assembly. I'd like to make sure it's not visible
outside the assembly.
C# has modifiers 'public', 'private', and 'internal'. Internal
relates to access within an assembly. Does C++ have anything
analogous?
Bruno van Dooren - 08 Mar 2006 07:57 GMT
> I have one class that is used as a low-level utility class by other
> classes in the same assembly. I'd like to make sure it's not visible
[quoted text clipped - 3 lines]
> relates to access within an assembly. Does C++ have anything
> analogous?
If you are making a managed classlib in C++/CLI, then yes. It allows the
same access control mechanisms as C#.
In native C++ there is no such thing.
You have public, private, friend and protected, but there is no difference
in method / member access between usage inside or outside a library.

Signature
Kind regards,
Bruno.
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
David Anton - 08 Mar 2006 15:04 GMT
Both managed C++ (2003) and C++/CLI have the equivalent:
C++/CLI:
If a top-level type: use "private"
else: use "internal"
Managed C++ (2003):
use "public private"

Signature
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter
> I have one class that is used as a low-level utility class by other
> classes in the same assembly. I'd like to make sure it's not visible
[quoted text clipped - 3 lines]
> relates to access within an assembly. Does C++ have anything
> analogous?
_iycrd - 09 Mar 2006 07:00 GMT
>Both managed C++ (2003) and C++/CLI have the equivalent:
>
>C++/CLI:
>If a top-level type: use "private"
>else: use "internal"
The 'UtilClass' in question needs to be used by multiple classes in
the same assembly, so it must be top-level. Looks like there is no
way to restrict UtilClass so it's not visible outside the assembly?
David Anton - 09 Mar 2006 15:00 GMT
(As I posted previously):
C++/CLI:
If a top-level type: use "private" - this will allow use from anywhere in
the assembly, but not outside of the assembly (if not top-level, use
"internal").
Managed C++ (2003):
use "public private" (the more restrictive modifier applies outside the
assembly, making it invisible outside the assembly).

Signature
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter
> >Both managed C++ (2003) and C++/CLI have the equivalent:
> >
[quoted text clipped - 5 lines]
> the same assembly, so it must be top-level. Looks like there is no
> way to restrict UtilClass so it's not visible outside the assembly?