I have a class hierarchy:
ClassA inherits from NSObjectClassB inherits from ClassAClassA implements copyWithZone: as follows:
implementation:
-(id)copyWithZone:(NSZone *)zone { ClassA *clone = [[ClassA allocWithZone:zone] init]; // other statements return clone; }
ClassB implements the same method as this
-(id)copyWithZone:(NSZone *)zone { ClassB *clone = [super copyWithZone:zone]; // other statements return clone; }
ClassC has the following property:
@property(nonatomic, copy) ClassA *classA;
so when i do something like this:
ClassB *classBPtr = [[ClassB alloc] init]; ClassC *classCPtr = [[ClassC alloc] init]; [classCPtr setClassA:classBPtr]; // other code
somehow, the ClassA property ClassA never understands that the ClassA pointer actually points to an instance of ClassB . so if I call a method on ClassA , it will only call the base class implementation (one in ClassA ) instead of the derived class implementation in ClassB
any ideas i could have messed up with this?
objective-c iphone
user83950
source share