I have class1.m . I declared a method and written in it. Now i need to call it into another class. How can I make it? Can we use extern for it like we use for variables.
Thank you.
I have class1.m . I declared a method and written in it. Now i
Share
You should separate your declaration and definition, and place the declaration for class1 in class1.h. Then, you should include class1.h using
#import "class1.h"in your source file for class2. Within class2, you can instantiate and use class1 as follows:When you are done using your instance, be sure to decrement the reference count via release as in: