Is subclassing C++ classes supported?

Yes. It does support sub-classing C++ classes or inheriting from C++ classes. You can define your C# classes inheriting from the C# wrapper class, logically, the deriving C# class will become a subclass of the original C++ class. Marshaling the deriving C# class to the original C++ class will be just like passing a native object of the C++ subclass. From C# code, you can access an instance of the deriving class just like accessing a C++ subclass of the original C++ class, or just the original C++ class, It will be treated as a C# wrapper class of a C++ subclass of the original C++ class. The C++ DLL does not see a difference of the C# deriving class and the original C++ class.


← Faqs
Translate »