Neo Neo - 2 years ago 81
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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download