私は2つのクラスを持っています:
BaseClass : NSObject
AdvanceClass : BaseClass
そして AdvanceClass には初期化子があります:
-(id)initWithBaseObject:(BaseClass *)bObj
{
if(self = [super init]) {
self = (AdvanceClass*)bObj;
}
return self;
}
そして、私が呼び出しているときにTRUEになると:
[myObject isKindOfClass:[BaseClass class]]
なんで?bObj を AdvanceClass オブジェクトにキャストしています。
ここでやりたいことは、BaseClass のすべてのプロパティを bObj オブジェクトのプロパティに割り当てることです。どうやってやるの?