首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

obj c car 各类已拆分(此程序不符合内存储器管理规则)

2012-09-09 
obj c car 各类已拆分(此程序不符合内存管理规则)xcode4.2未了把代码看清楚,拆分main.m:////Car.m//carDem

obj c car 各类已拆分(此程序不符合内存管理规则)

xcode4.2

未了把代码看清楚,拆分

main.m:

////  Car.m//  carDemo////  Created by Wunderman on 12-1-3.//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.//#import "Car.h"@implementation Car- (Engine *) engine {    return engine;}- (void) setEngine:(Engine *) newEngine {    engine = newEngine;}- (Tire *)tireAtIndex: (int) index {    if (index >3 || index < 0) {        NSLog(@"bad index %d", index);        exit(1);    }    return tires[index];}- (void) setTire: (Tire *) tire         atIndex: (int) index {    if (index >3 || index < 0) {        NSLog(@"bad index %d", index);        exit(1);    }    tires[index] = tire;}- (void) print {    NSLog(@"%@", engine);    NSLog(@"%@", tires[0]);    NSLog(@"%@", tires[1]);    NSLog(@"%@", tires[2]);    NSLog(@"%@", tires[3]);}@end
?

?

?

?

?

?

?

?

热点排行