E
Edward Diener
In Managed C++ in order to share the functionality of a class between
its CLR code and native C++ code, in essence mixed mode programming for
a class, I would design the __gc class so its corresponding __nogc C++
class would be a nested class of the __gc class. The __gc class would
have a pointer to the __nogc C++ class as a private data member. Then
when the __gc class created an object of the native class, it would pass
itself as a pointer to the __nogc C++ class's constructor. The __nogc
class would put this pointer into a corresponding gcroot<>. Then the
__nogc class would be able to access all the members of its
corresponding __gc class via this pointer since, in the 2003 C++ update,
a nested class now has access to all the members of its enclosing class
via a pointer to that class, and VC++ implements that 2003 C++ item.
Now in C++/CLI using this same technique I am told that a ref class can
not have a nested native C++ class.
Oh brother !!!!!
How I am now supposed to access the public, protected, and private
members of a ref class from its corresponding native C++ class using
mixed mode programming in C++/CLI ?
If you tell me that I have to now redesign all my Managed C++ code so
that protected and private data members of my class must now be passed
to a corresponding native C++ class whenever it needs this
functionality, I will not be a happy camper.
its CLR code and native C++ code, in essence mixed mode programming for
a class, I would design the __gc class so its corresponding __nogc C++
class would be a nested class of the __gc class. The __gc class would
have a pointer to the __nogc C++ class as a private data member. Then
when the __gc class created an object of the native class, it would pass
itself as a pointer to the __nogc C++ class's constructor. The __nogc
class would put this pointer into a corresponding gcroot<>. Then the
__nogc class would be able to access all the members of its
corresponding __gc class via this pointer since, in the 2003 C++ update,
a nested class now has access to all the members of its enclosing class
via a pointer to that class, and VC++ implements that 2003 C++ item.
Now in C++/CLI using this same technique I am told that a ref class can
not have a nested native C++ class.
Oh brother !!!!!
How I am now supposed to access the public, protected, and private
members of a ref class from its corresponding native C++ class using
mixed mode programming in C++/CLI ?
If you tell me that I have to now redesign all my Managed C++ code so
that protected and private data members of my class must now be passed
to a corresponding native C++ class whenever it needs this
functionality, I will not be a happy camper.