Neo
Neo

Reputation: 167

Objective-C casting of custom classes

Let say I have a custom class named as:

classA

and I have another custom class named as:

classB

How could I cast classA to classB?

Upvotes: 0

Views: 586

Answers (1)

piyuj
piyuj

Reputation: 163

Same way as C/C++:

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

Upvotes: 1

Related Questions