码迷,mamicode.com
首页 > 其他好文 > 详细

内存管理.

时间:2014-10-09 01:02:17      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:io   sp   c   on   log   r   ad   bs   管理   

#import "ViewController.h"

#import "Fish.h"

#import "Cat.h"

@interface ViewController ()

 

@end

 

@implementation ViewController

 

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

    Cat * cat =[[Cat alloc]init];

    Fish * seafish =[[Fish alloc]init];

    Fish * goldfish =[[Fish alloc]init];

    [cat EatGoldfish:goldfish];

   [cat EatSeafish:seafish];

    [cat setGoldfish : seafish];

    [cat gotocathgoldfish];

    [cat release];

    [seafish release];

    [goldfish release];

    

}

 

#import "Fish.h"

 

@implementation Fish

 

- (void)goldFishMeet_cat;

{

    NSLog(@"the fish meet cat ,it still here.....");

}

- (void)seaFishMeet_cat;

{

    NSLog(@"the fish m

eet cat,it run at once");

}

#import "Cat.h"

 

@implementation Cat

 

- (void)EatSeafish:(Fish *)seafish;

{

    NSLog(@"the cat do not eat seafish");

    

    

        

}

- (void) setGoldfish :(Fish *) fish

{

   _goldfish = fish;

}

- (void)EatGoldfish:(Fish *)goldfish;

{

    NSLog(@"the cat like goldfish,but cat do not like goldfish");

    

}

- (void)gotocathgoldfish

{

    

    [_goldfish  goldFishMeet_cat];

}

- (void)gotocathseafish

{

    [_seafish  seaFishMeet_cat];

}

 

 

- (void)dealloc;

{

    [_seafish release];

    [_goldfish release];

    [super dealloc];

}

@end

 

 

@end

 

内存管理.

标签:io   sp   c   on   log   r   ad   bs   管理   

原文地址:http://www.cnblogs.com/wangweixl/p/4011905.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!