I want the method to have access to a subset of the method declared in the same class. Obviously, this can be achieved by protocols.
A subset of the method is declared in HouseProtocol, and the House class implements its methods.
@protocol HouseProtocol <NSObject> -(void) foo; @end
.
@interface House : NSObject <HouseProtocol> -(void) foo; -(void) bar; @end
Somewhere else in another class, a method is defined with the HouseProtocol argument:
-(void) somemethod:(id<HouseProtocol>)hp;
This method should use home methods, but only those available at HouseProtocol. The value of the foo method, but not the method bar.
Is this correct, and how is the foo method called inside somemethod? The working code is appreciated.
source share