Reputation: 4929
I need to pass Objective C object instance to C++ method trough params. How I can do it?
This code doesn't work, and I know it. I'm just showing what I want.
MyObjcClass *instance = [[MyObjcClass alloc] init];
myCppClassInstance.myCppMethod(instance);
Upvotes: 1
Views: 1094
Reputation: 2722
class
is a keyword, so it won't work I agree. But for me there are no other issue in your sample code.
Juste declare your cpp method
void myCppMethod(MyObjcClass *obj) {
}
and use it like you did
MyObjcClass *obj = [[MyObjcClass alloc] init];
myCppMethod(obj);
Upvotes: 1