Can I access private fields of a C++ class for whatever reason?

Sure, if that is what you really what. We would like to make it very flexible for you, the decision is yours. Since they are private fields which are not supposed to be accessed from outside of the class, you have been warned.

The .NET PInvoke Interop SDK can let you choose to implement private fields as private, protected or public properties in C#, but once again, you are breaking the contract of the C++ class by letting the private fields to be accessed from outside of the C++ class.

There is one thing to keep in mind, since private fields are designed to be accessed only from inside of the class, not all of the types of the fields are known to C# wrapper class through the C++ DLL interface, some of the field types may be internal to the C++ DLL hence there may be no way to create or manipulate them from C# no matter what.


← Faqs
Translate »