Neo Neo - 1 year ago 61
Objective-C Question

Objective-C casting of custom classes

Let say I have a custom class named as:


and I have another custom class named as:


How could I cast classA to classB?

Answer Source

Same way as C/C++:

ClassA* objectA = [[ClassA alloc] init];
ClassB* objectB = (ClassB*) objectA;