- //
- // main.m
- // 1124
- //
- // Created by 梓铭 王 on 14-11-23.
- // Copyright (c) 2014年 梓铭 王. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- @interface ShenCaiShuJu : NSObject
- {
- int _height;
- int _weight;
- int _handL;
- int _legL;
- }
- -(void)setHeight:(int)height;
- -(int)height;
- -(void)setWeight:(int)weight;
- -(int)weight;
- -(void)setHandL:(int)handL;
- -(int)handL;
- -(void)setLegL:(int)legL;
- -(int)legL;
- @end
- @implementation ShenCaiShuJu
- -(void)setHeight:(int)height
- {
- _height=height;
- }
- -(int)height
- {
- return _height;
- }
- -(void)setWeight:(int)weight
- {
- _weight=weight;
- }
- -(int)weight
- {
- return _weight;
- }
- -(void)setHandL:(int)handL
- {
- _handL=handL;
- }
- -(int)handL
- {
- return _handL;
- }
- -(void)setLegL:(int)legL
- {
- _legL=legL;
- }
- -(int)legL
- {
- return _legL;
- }
- @end
- @interface Person : ShenCaiShuJu
- {
- int _age;
- }
- -(void)setAge:(int)age;
- -(int)age;
- @end
- int main(int argc, const char * argv[]) {
- @autoreleasepool {
-
- Person *p = [Person new];
- [p setHeight:170];
- [p setWeight:60];
- [p setHandL:100];
- [p setLegL:70];
- [p setAge:20];
- NSLog(@"%d %d %d %d %d",[p age],[p height],[p weight],[p handL],[p legL]);
- }
- return 0;
- }
复制代码
这段代码不能运行 然后错误不再代码里 在外面 求解答
|