大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
方法 | 问题或行为 |
-(BOOL) isKindOfClass : class-object | 对象是不是class-object或其子类的成员 |
-(BOOL) isMemberOfClass:class-object | 对象是不是class-object的成员 |
-(BOOL) respondsToSelector:Selector | 对象是否能够响应selector所指定的方法 |
-(BOOL) instancesRespondToSelector | 指定的类实例是否能响应selector |
-(BOOL) isSubclassOfClass:class-object | 对象是否是指定类的子类 |
-(id) performSelector:selector | 应用selector指定的方法 |
-(id) performSelector:selector withObject:object | 应用selector指定的方法 |
-(id) performSelector:selector withObject:object1 withObject : object2 | 应用selector指定的方法 |
测试实验设计
创新互联是一家专注于网站建设、网站制作与策划设计,巴青网站建设哪家好?创新互联做网站,专注于网站建设10多年,网设计领域的专业建站公司;建站业务涵盖:巴青等地区。巴青做网站价格咨询:18982081108继承关系图:
Rectangle.h
Square.h
在main.h中的测试如下:
// // main.m // Square // // Created by Apple on 2017/9/9. // Copyright 2017年 Apple. All rights reserved. // #import#import "Square.h" int main(int argc, const char * argv[]) { @autoreleasepool { Square *mySquare = [[Square alloc] init]; //isMemberof if( [mySquare isMemberOfClass:[Square class]] == YES ) { NSLog(@" mySquare is a member of Square class ");// } if( [mySquare isMemberOfClass:[Rectangle class]] == YES ) { NSLog(@"mySquare is s member of Rectamgle class"); } if([mySquare isMemberOfClass:[NSObject class]] == YES) { NSLog(@"mySquare is a member of NSObject class"); } //isKindOf if( [mySquare isKindOfClass:[Square class]] == YES ) { NSLog(@" mySquare is a kind of Square class ");// } if( [mySquare isKindOfClass:[Rectangle class]] == YES ) { NSLog(@"mySquare is s kind of Rectamgle class"); } if([mySquare isKindOfClass:[NSObject class]] == YES) { NSLog(@"mySquare is a kind of NSObject class");// } //respondsTo: if( [mySquare respondsToSelector:@selector(setSide:)] == YES ) { NSLog(@" mySquare responds to setSide : method "); } if( [mySquare respondsToSelector:@selector(setWidth:addHeight:)] == YES ) { NSLog(@"mySquare responds to setWidth:addHeight : method"); } if([Square respondsToSelector:@selector(alloc)] == YES) { NSLog(@"Square class responds to alloc method"); } //instancesRespondTo: if( [Rectangle instancesRespondToSelector:@selector(setSide:)] == YES ) { NSLog(@"Instances of respond to setSide : method"); } if( [Square instancesRespondToSelector:@selector(setWidth:addHeight:)] == YES ) { NSLog(@"Instances of Square respond to setWidth:addHeight: : method"); } if([Square isSubclassOfClass:[Rectangle class]] == YES) { NSLog(@"Square is a subclass of a rectangle"); } return 0; } }
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。