Cory Imdieke
Cory Imdieke

Reputation: 14828

Can Parse Subclassing handle multiple layers on inheritance?

I'm creating subclasses of PFObject and want to know how I can organize my code. Let's say I want to do this:

@interface Person : PFObject<PFSubclassing>

@property (nonatomic, copy) NSString *firstName;
@property (nonatomic, copy) NSString *lastName;

@end



@interface Employee : Person

@property (nonatomic, copy) NSNumber *salary;

@end

Would Parse know how to handle this? I know Person would work just fine, but I'm not sure about Employee. I'd like to be able to call [(Employee *)myEmployee firstName] and have it work properly. My actual usage will be quite a bit more complicated, which I why I want to keep all like-methods in the same place.

Upvotes: 0

Views: 280

Answers (1)

Ryan Kreager
Ryan Kreager

Reputation: 3581

Given your answers above, yes, this can be done.

However, there are some pitfalls to avoid surrounding how Parse handles subclassing. The easiest thing here is to read through this thread at Parse.com that explains errors and workarounds to ensure harmonious subclassing:

https://www.parse.com/questions/what-does-this-error-mean-subclasses-of-subclasses-may-not-have-separate-parseclassname-definitions

Best of Luck!

Upvotes: 1

Related Questions