In objective-c. I can declare two method. the private (-) method, which is access inside the class, or by the class instance.
for example,
in .h
file: I declare:
-(void)privateMethodA;
+(void)publicMethodA;
In .m
file, I can do
[self privateMethodA];
In other class , like classB .m
file; also I can do
ClassA *objA;
[objA privateMethodA];
However, for public method. which is called static method, I guess.
[ClassA publicMethodA];
is enough to access method A in ClassB .m
file
In sum up, I can skip the step to declare a instance to access a private method, and just use the [ClassName publicMethodName];
For convenience, I can declare all the method to be public method... So problem is coming, for good program design, what is the difference? Is there something about the memory, such as heap memory, stack memory?