how to assign object of interface to a protocol’s object?
i’ve a protocolA and protocolB. all the methods of both the protocols is implemented in MyClass.How to restrict the access to only protocolA’s methid and protocolB’s methods ?Coding is done in Objective-C for iPhone application.
how to assign object of interface to a protocol’s object? i’ve a protocolA and
Share
On object creation you can just do this:
Now, unless you use an explicit cast, you can’t use protocolB methods.
You can also cast objects of class MyClass to either protocolA or protocolB like this: