Are these basically the same thing?
For example if I have an interface in Java
public interface CoolObject{
...
}
I can use any object that implements the CoolObject
interface in functions that take a CoolObject
as a parameter:
public void foo(CoolObject o) {
...
}
Is this the same in Objective-C?
@protocol CoolProtocol
...
@end
@interface Foo: NSObject <CoolProtocol>
...
@end
(void) - someMethod: (CoolProtocol *) obj {
}
Would the above work (and be considered correct?)
Thanks for your time. Let me know if you need me to clarify my question.