7
継承されたクラスのプライベートプロパティにアクセスしようとしています。それはリンゴを与えたその命名規則で可能ですか?Objective-C:継承されたクラスのプライベートプロパティにアクセス
ヘッダー:
#import <Foundation/Foundation.h>
@interface FooBar : NSObject
-(void)doSomeThingWithThisNumber:(NSInteger)aNumber;
@end
実装:
#import "FooBar.h"
@interface FooBar()
@property NSInteger myPrivateFoo;
@end
@implementation FooBar
@synthesize myPrivateFoo = _myPrivateFoo;
-(void)doSomeThingWithThisNumber:(NSInteger)aNumber
{
_myPrivateFoo = aNumber;
}
@end
私は_myPrivateFoo
にアクセスすることはできません新しいものにこのクラスを継承している場合。ヘッダファイルの宣言の代わりにそれを行う別の方法はありますか?
いいですね。 self.myPrivateFooでのみ使用できます。 ;)Ty! –
動作しているので、自分の答えを正しいものとしてマークする必要があります。 –
申し訳ありません、新しいです。 –