A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

//  Person.h
//  ios初体验
//
//  Created by wjy0916 on 15/9/22.
//  Copyright (c) 2015年 ios. All rights reserved.

#import <Foundation/Foundation.h>

@interface Person : NSObject
-(void) run;
@end


//  Person.m
//  ios初体验
//
//  Created by wjy0916 on 15/9/22.
//  Copyright (c) 2015年 ios. All rights reserved.

#import "Person.h"

@implementation Person
-(void) run{

    NSLog(@“Person——人在跑--------");
}

-(void)talk{

    NSLog(@"talk+++++++++++++++++");
}
@end


Teacher *t = [Teacher new];
SEL s1 = @selector(talk);
BOOL b = [t respondsToSelector:s1];
NSLog(@“++++++++++++++%d",b);

Teacher 类中无任何代码,仅仅继承了,Person类
此时b = 1;
用t响应方法play是报错。

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马