本帖最后由 程序猿-2014 于 2014-4-11 14:35 编辑
#import <Foundation/Foundation.h> @interface Person : NSObject { int _age;
@public int _no; int _weight;
@private int _height;
@protected int _money; } @end
@interface Student : Person - (void)test; @end
@implementation Student { int _money; @public int _friendsCount; } - (void)test { _age = 10; _no = 1; _money = 100; _height = 170; } @end
int main() { Student *s = [Student new]; s->_no = 1;
s->_color = 10; s->_friendsCount = 500; return 0; }
@implementation Person { NSString *_name; @public int _color; } @end 这个题哪里有问题啊 回答的最好直白点 对作用域的问题有点晕
|