I have two classes:
BaseClass : NSObject
AdvanceClass : BaseClass
And in AdvanceClass i have an initializer:
-(id)initWithBaseObject:(BaseClass *)bObj
{
if(self = [super init]) {
self = (AdvanceClass*)bObj;
}
return self;
}
And then when i get TRUE when i’m calling:
[myObject isKindOfClass:[BaseClass class]]
Why? I’m casting bObj to AdvanceClass object.
What i want to do here is assign all of the properties from BaseClass with properties from bObj object. How can i do that?
I’ve just realize that the best way is write a public method in
BaseClassand call it from initializer. In that case you can only write this once, and it is simply to edit.And in BaseClass.m
This is obvious solution, silly me.