- 213 名前:デフォルトの名無しさん mailto:sage [2009/08/14(金) 16:47:25 ]
- Objective-Cって継承でmethodをoverrideしたあとに更にそれを継承してもう一回overrideした場合、superで呼び出すと最終override以外のすべてが呼び出されるもんなの?
sample #import <Foundation/NSObject.h> #import <stdio.h> @interface A: NSObject - (void)method1; - (void)method2; @end @implementation A - (void)method1 { printf("method1 of Class A\n"); } - (void)method2 { printf("method2 of Class A\n"); } @end @interface B: A - (void)method2; @end @implementation B - (void)method2 { printf("method2 of Class B\n"); printf("self --> "); [self method1]; printf("super--> "); [super method2]; } @end
|

|