美文网首页
xunhuanyinYong

xunhuanyinYong

作者: json_jie | 来源:发表于2015-03-19 16:19 被阅读20次

    import <Foundation/Foundation.h>

    @class Jie;
    @interface Zhao : NSObject
    {
    Jie *_jie;
    }
    @property(nonatomic,retain)Jie *jie;
    @end

    import "Zhao.h"

    import "Jie.h"

    @implementation Zhao

    -(void)dealloc
    {
    [super dealloc];
    [_jie release];
    NSLog(@"Zhao dealloc");

    }

    @end

    import <Foundation/Foundation.h>

    @class Zhao;
    @interface Jie : NSObject
    {
    Zhao *_zhao;
    }
    @property(nonatomic,assign)Zhao *zhao;
    @end

    import "Jie.h"

    @implementation Jie

    -(void)dealloc
    {
    [super dealloc];
    // [_zhao release];

    NSLog(@"Jie dealloc");
    

    }
    @end

    import <Foundation/Foundation.h>

    import "Jie.h"

    import "Zhao.h"

    int main(int argc, const char * argv[]) {
    @autoreleasepool {

        Zhao *zhao =[[Zhao alloc ] init];
        Jie *jie = [[Jie alloc] init];
        NSLog(@"zhao   %ld  jie %ld",zhao.retainCount,jie.retainCount);
        
        [zhao setJie:jie];
        [jie setZhao:zhao];
    
        NSLog(@"zhao   %ld  jie %ld",zhao.retainCount,jie.retainCount);
        [zhao release];
        [jie release];
    }
    return 0;
    

    }

    相关文章

      网友评论

          本文标题:xunhuanyinYong

          本文链接:https://www.haomeiwen.com/subject/pzjwxttx.html