In your MainViewClass.h, you'll want to add your int as a property of that class.
@property (nonatomic, readwrite) int score;
Then in your MainViewClass.m, you'll want to synthesize the property using:
@synthesize score;
Now since your subclassing MainViewClass in your OtherClass you can access it's properties using some combination of the following.
In your OtherClass.h add
MainViewClass *mainViewClass;
in your OtherClass.m wherever you need access to the score, you should be able to access it as such.
mainViewClass = (MainViewClass *) self.parent;
and then the score using,
mainViewClass.score;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…