本帖最后由 ★彬★卍囧神 于 2014-8-11 10:47 编辑
- <div align="left"><div class="blockcode"><blockquote>#import<Foundation/Foundation.h>
- @interface Score : NSObject
- {
- int _cScore;
- int _ocScore;
- int _zhongFenScore;
- int _averageScore;
- }
- - (void)setCScore:(int)cScore;
- - (int)cScore;
- - (void)setOcScore:(int)ocScore;//这是第12行
- - (int)ocScore;
- - (int)zhongFenScore;
- - (int)averageScore;
- @end
- @implementation Score //这是 第19行
- - (void)setCScore:(int)cScore
- {
- _cScore = cScore;
- _zhongFenScore = _cScore + _ocScore;
- _averageScore = _zhongFenScore/2;
- }
- - (int)cScore
- {
- return _cScore;
- }
- - (void)setOcScor:(int)ocScore
- {
- _ocScore = ocScore;
- _zhongFenScore = _cScore + _ocScore;
- _averageScore = _zhongFenScore/2;
- }
- - (int)ocScore
- {
- return _ocScore;
- }
- - (int)zhongFenScore
- {
- return _zhongFenScore;
- }
- - (int)averageScore
- {
- return _averageScore;
- }
- @end
- int main()
- {
- Score *s = [Score new];
- [s setCScore:90];
- [s setOcScore:92];
- int a = [s zhongFenScore];
- //int b = [s averageScore ];
- NSLog(@"总分:%d",a);
- // NSLog(@"平均分:%d",b);
- return 0;
- }
- 系统 报错 我一直 没找到 那错了 求助 急急急!!!!
- 37-封装练习.m:19:17: warning: method definition for 'setOcScore:' not found
- [-Wincomplete-implementation]
- @implementation Score
- ^
- 37-封装练习.m:12:1: note: method 'setOcScore:' declared here
- - (void)setOcScore:(int)ocScore;
- ^
- 1 warning generated.
复制代码
|