You can always pass an equivalent Object in CLI depending on type (Managed/Native) of object.
public class NativeObject
{
private:
int id;
string msg;
SomeClass obj;
.......
public:
string getMessage(){return msg;}
int getID(){return id;}
...
}
It's Managed equivalent will be
public ref class ManagedObject
{
private:
NativeObject* native;
public:
ManagedObject(NativeObject* obj){
native = obj;
}
String^ getMessage(){
convertNativeToCLI(native->getMessage()); //you can use marshaling to implement convertNativeToCLI method.
}
int getID(){
return native->getID();
}
...
}
and you will need a Binder or Interface class to convert one object from one form to another. Generally we use this approach when we have complex objects. If we have only few simple data object then this approach will unnecessary put extra overhead.