Geometry と Circle の 2 つのクラスがあります。Circle は Geometry のサブクラスです。
ジオメトリには合成プロパティがあります。
インターフェース:
@interface Geometry : NSObject <drawProtocol, intersectionProtocol>
@property int geoLineWidth;
実装:
@synthesize geoLineWidth;
Circle は Geometry のサブクラスです。インターフェース:
@interface Circle : Geometry
このコードは、Geometry のメソッド内で Geometry.m にコンパイルされます。
NSLog(@"%d", geoLineWidth);
このコードは、Circle のメソッド内でコンパイルされません。
NSBezierPath * thePath= [NSBezierPath bezierPath];
[thePath setLineWidth: geoLineWidth];
Use of undeclared identifier 'geoLineWidth'
ただし、このコードは次のようにコンパイルされます。
[thePath setLineWidth: [self geoLineWidth]];
この動作は意図的なものですか、それとも何か不足していますか?