A native 'public class' or 'private class' in VC8

E

Edward Diener

Specifying 'public class' or 'private class' for C++ class definitions
is not part of the C++ standard. In a topic in the VS 2005 docs 'How to:
Declare public and private on Native classes', it is suggested that this
syntax is supported with VC8 for interaction with CLR ref classes and
for specifying in a CLR assembly.

However in the specific C++ language documentation for native classes,
there is no mention of the possibility of prepending 'class' with either
'public' or 'private'. Furthermore where it is explained in the first
topic above there is no explanation of what it actually means for native
classes, other than the implied suggestion that it treats native classes
like ref classes in CLR assemblies as regards the 'public' and 'private'
keywords in front of a ref class.

Can anybody clear up for me whether this is supported for native classes
in CLR assemblies and what it actually means given the abysmal MSDN
documentation on it ?
 
H

Holger Grund

Edward Diener said:
However in the specific C++ language documentation for native classes,
there is no mention of the possibility of prepending 'class' with either
'public' or 'private'. Furthermore where it is explained in the first
topic above there is no explanation of what it actually means for native
classes, other than the implied suggestion that it treats native classes
like ref classes in CLR assemblies as regards the 'public' and 'private'
keywords in front of a ref class.
The compiler emits value type definitions for native classes. Note
that these specify size and alignment only and the layout is done
at the C++ compiler's discretion. I guess, that was just a convenient
way to emit code from a lowered IR.

The access specifier controls the visibility of the generated value type.

-hg
 
B

bonk

Yes, EVERY (no matter if you use #pragma managed or #pragma unmanaged)
native class ends up as a managed value type in the assembly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top