Class extensions and protocols


#1

Can someone break down a little bit of why you would declare a protocol in the header file vs in the class extension.

bignerdranch.com/blog/protoc … ions-bork/

this article explains it, and I think i grasp this concept about 95%. I’m just having trouble coming up with another example on my own, which tells me I don’t exactly understand.

if i write a protocol called that has a method called -(void)walk

every class that implements this in the header file would need recompiled if i would change the code in -(void)walk or added another method -(void)stop ? is that a true statement?

if that is the truth and i decided to declare a class to adhere to this protocol in the class extension in the.m file instead i would NOT have to recompile any classes that use it as long as the methods are still there?


#2

the class implementing doesn’t care what kind of action move needs to perform, just wants to know the class is moveable. so this example may not be correct.

any help is appreciated