作者ksksBangBang (Bang!)
看板MacDev
标题Re: [问题] 继承方面的问题
时间Tue Oct 9 04:03:12 2012
※ 引述《round1121 (圆儿)》之铭言:
: 请问 两个继承不一样的 可以相互跨越吗?
: EX : @interface A : NSObject @interface B : UIViewControl
: . .
: . .
: -(void) A_function; -(void) B_function;
: . -(void) B1_function;
: . .
: . .
: @end @end
: 假若 B 宣告在 A 前面,理应上 A_function 就能呼叫 B_function or B1_function
: 那有没有办法在这情况下,B or B1 function 也能呼叫 A_function呢 ?
: 麻烦大师解惑了 >0<
既然你的A.h没有用到B, B.h没有用到A
那直接在A.m中 #import "B.h", B.m中 #import "A.h"就可以了
还是你这样做了遇到什麽问题吗
如果你的A function中有B, B fuction中有A, 如:
- (void)A_functionWithB:(B*)b;
- (boid)B_functionWithA:(A*)a;
那就在A.h 加上@class B, 在B.h加上@class A, 然後.m中再import
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 199.2.242.199