objective c - Is there a way for a method in a derived class to not override the base class method -
i in process of learning objective-c coming c++ background. wanted know if there way derived class method has same signature base class not override it. read every method in objective-c virtual.are there ways in derived class not override base class method simulated ?
i have following 2 classes
@interface foo_base : nsobject -(void) base_method; -(void) shared_method; @end @interface foo_der : foo_base -(void) der_method; -(void) shared_method; @end
and when use this
foo_base *b = [[foo_der alloc]init]; [b shared_method]; //derived class method called.
i know inside derived class method
[super shared_method] //call base class method
no, in objective-c if derived class implements base class method same signature, overridden. create "helper" function if want access base class method directly.
- (void) callsupersharedmethod { [super sharedmethod]; }
Comments
Post a Comment