Objective-C multiple inheritance -


i have 2 classes 1 includes methoda , other include methodb. in new class need override methods methoda , methodb. how achieve multiple inheritance in objective c? little bit confused syntax.

objective-c doesn't support multiple inheritance, , don't need it. use composition:

@interface classa : nsobject { }  -(void)methoda;  @end  @interface classb : nsobject { }  -(void)methodb;  @end  @interface myclass : nsobject {   classa *a;   classb *b; }  -(id)initwitha:(classa *)ana b:(classb *)ab;  -(void)methoda; -(void)methodb;  @end 

now need invoke method on relevant ivar. it's more code, there isn't multiple inheritance language feature in objective-c.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

c# - How to execute a particular part of code asynchronously in a class -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -