I'm having trouble calling a C++ constructor in my Visual Basic code. The DLL has been imported correctly but this line in particular is giving me trouble:
Dim myobj As New MyObject("param1", "param2", "param3")
And the corresponding C++ constructor:
MyObject::MyObject(System::String ^ p1, System::String ^ p2, System::String ^ p3)
Any suggestions?
You can't. It's simply not supported this way.
The easiest way of doing it is to just convert the constructor into a function (eg Initialize()).
You can't - the class will be instantiated with a default constructor. If you need parameterized construction you have two options - either add an "initialize" parameterized method to the class or add a factory class with an "instantiate the first class with this parameters" method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With