Just wondering how you extend a class with both c++ and obj c code in it (eg. ofxiPhoneCoreLocation). I can directly change the class with new methods, but this is not very good for extendibility (i want to release the code when project is finished).
eg. The new class will be ‘ofxiPhoneCoreLocationExtras’ which extends ‘ofxiPhoneCoreLocation’.
Thanks in advance.
I could be wrong but can’t you just do something like the following?
ofxiPhoneCoreLocationExtras : public ofxiPhoneCoreLocation
and then anything you want to add in can just call ofxiPhoneCoreLocationDelegate * coreLoc since it’s protected.
But what if you want to add new properties & methods to the objc ofxiPhoneCoreLocationDelegate? Would you need to extend this as well, eg. the new delegate would be something like ofxiPhoneCoreLocationDelegateExtra *coreLoc?
That’s correct, you just need to extend ofxiPhoneCoreLocationDelegate and have a ptr to that which is initialized, though, at that point your extended class would have pointers to the original ofxiPhoneCoreLocationDelegate and the extension of that class, which seems sort of pointless. Depending on what you’re doing it might be cleaner to just call anything additional directly on ofxiPhoneCoreLocationDelegate locationManager instead of extending ofxiPhoneCoreLocationDelegate. There may also be some ObjC magic way out of this but I don’t know the core language well enough to be too helpful, sorry