zoukankan      html  css  js  c++  java
  • OC2_ARC MRC混合编程

    //
    //  main.m
    //  OC2_ARC MRC混合编程
    //
    //  Created by zhangxueming on 15/6/19.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    #import "Person.h"
    #import "Dog.h"
    
    //-fno-objc-arc    BuildPhases 下的 complle Sources  (Compiler Flags)  person.m 跟 dog.m   添加 -fno-objc-arc
    int main(int argc, const char * argv[]) {
        @autoreleasepool {
            Person *xiaoHua = [[Person alloc] init];
            Dog *dog = [[Dog alloc] init];
            xiaoHua.dog = dog;
        }
        return 0;
    }
    
    
    
    //
    //  Dog.h
    //  OC6_复合类的类存管理
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    
    @interface Dog : NSObject
    
    @property (copy, nonatomic) NSString *name;
    @property (assign,nonatomic) NSInteger age;
    
    @end
    
    
    
    //
    //  Dog.m
    //  OC6_复合类的类存管理
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import "Dog.h"
    
    @implementation Dog
    
    - (void)dealloc
    {
        NSLog(@"%@: dog name is release!!!", [self class]);
        [_name release];
        [super dealloc];
    }
    
    @end
    
    
    
    //
    //  Person.h
    //  OC6_复合类的类存管理
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    #import "Dog.h"
    
    @interface Person : NSObject
    
    @property (retain, nonatomic) Dog *dog;
    
    @end
    
    
    
    //
    //  Person.m
    //  OC6_复合类的类存管理
    //
    //  Created by zhangxueming on 15/6/18.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import "Person.h"
    
    @implementation Person
    
    - (void)dealloc
    {
        NSLog(@"%@:dog is release", [self class]);
        [_dog release];
        [super dealloc];
    }
    
    
    @end
  • 相关阅读:
    spring cloud中代理服务器zuul的使用
    springcloud断路器Dashboard监控仪表盘的使用
    Java中 final和static解析
    使用redis和thread告警并避免重复告警
    Windows 下redis的安装和使用
    服务端监控工具Nmon使用方法
    linux性能监控工具nmon生成HTML报告-EasyNmon
    接口测试用例设计
    RESTful API浅谈
    接口测试与总结
  • 原文地址:https://www.cnblogs.com/0515offer/p/4589544.html
Copyright © 2011-2022 走看看