class - Declaring and using multiple Objective-C classes in a single file -
i've used objective-c in sterile, textbook situation, have single class defined within single file, , having set of files, 1 implementation, , 1 interface.
i'm ready start traveling less preferable, quick-and-dirty means build classes, declaring , using multiple classes within single implementation file. (edit) don't plan in production code, test ideas off side if will, still able access data in full application, rather creating separate sandboxed xcode project it, not have access data i'll need test idea.
all educational material can find demonstrates sterile method of 1 .h , 1 .m file , single interface , implementation.
so want have classa, classb, , classc defined in classa's implementation file. still need declare interface classb , classc , in order in classa can declare stuff , have work properly.
thanks lot.
yes, have declare same things. should declare interfaces prior implementations.
but suggest not done save time , if there close relationship. example other languages allows sub-classes, in objective-c might candidate second class in same file. expect not class in header file.
i restrict classes used main class in file , main class's interface in header file. second class helper class main class. better letting class grow beyond single responsibility.
Comments
Post a Comment