|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
Hi All, I'm learning Obj-C, having mostly a Java background. Because of the large differences between these two languages I'm experiencing some troubles. One of those is the following: Often the need arises to have classes import each others header files. When this happens, the compiler throws up a compiling error. I was hoping the use of 'import' instead of 'include' would solve this, but it apparently does not. Still, I have found the following workarounds: - mostly, only one class needs to create objects of the other's class. The other class just needs a reference, and this reference can be 'NSObject' if need be. - use the @class directive so the compiler knows of the existence of the class, without importing the header file. These 'solutions' still result in comiler warnings. - create a 'stub' header file to be imported by the class that only needs a reference, which does not import its own header. All of this seems quite complicated (I hope I'm making sense), and I'm sure there is an elegant solution to this. Please help this Obj-C newbie Patrick Machielse _______________________________________________ studentdev mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/studentdev Do not post admin requests to the list. They will be ignored.
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.