OC中的 延展

Posted 唐唐_010

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OC中的 延展相关的知识,希望对你有一定的参考价值。

#import <Foundation/Foundation.h>

@interface Student : NSObject

-(void)Dothing;

@end

 

#import "Student.h"

 

@interface Student ()

-(void)Sleep;

@end

 

#import "Student.h"

 

@implementation Student

-(void)Dothing

{

    NSLog(@"Dothing");

}

-(void)Sleep

{

    NSLog(@"Sleep");

}

@end

 

#import <Foundation/Foundation.h>

#import "Student.h"

//#import "Student_Sleep.h"

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

{

    @autoreleasepool

{

        Student *stu=[[Student alloc] init];

        [stu Dothing];

        [stu Sleep];    

    }

    return 0;

}

 

以上是关于OC中的 延展的主要内容,如果未能解决你的问题,请参考以下文章

OC 中 类目延展和协议

iOS设计之--OC学习总结之延展类目协议

Objective-C中的类目,延展,协议

OC第九节 类的扩展

OC中的@的作用研究

ReactiveSwift源码解析 SignalProducerProtocol延展中的StartLift系列方法的代码实现