471,123 Members | 871 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

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

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 ?
Aug 5 '06 #1
2 1049
"Edward Diener" <ed*******************@tropicsoft.comwrote
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
Aug 5 '06 #2
Yes, EVERY (no matter if you use #pragma managed or #pragma unmanaged)
native class ends up as a managed value type in the assembly.

"Edward Diener" <ed*******************@tropicsoft.comschrieb im
Newsbeitrag news:OC****************@TK2MSFTNGP06.phx.gbl...
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 ?

Aug 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by David Kantowitz | last post: by
2 posts views Thread by Martin Zenkel | last post: by
1 post views Thread by =?Utf-8?B?RmFiaWFu?= | last post: by
4 posts views Thread by rwf_20 | last post: by
2 posts views Thread by Bob Altman | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.