How I can instantiate a Objective-c class into CPP class?
for example my CPP class:
class Foo{
public:
Foo();
private:
MyObjcClass* myObjcClass; //it does not work
}
how I can do this?
note I using .m for Objective-C and .cpp for C++.
Thanks a lot!
Either
id.If you use
id, you should introduce the type in your definitions, e.g.:In general, you should preserve the type (
MyObjcClass) and avoid usingid, but declaring the variable asidis compatible with C and C++, so you can useidto avoid compiling everything that includes Foo.hpp as ObjC++.