I have a question about subclass and class methods.
I have a base class MyBaseClassthat has a convenience class method
+ (id)giveMeAClassUsing:(NSString *)someParameter;
MyBaseClass not solitary.
Now I want to create a subclass MyBaseClass, call him MyChildClass. I want to have the same class method on MyChildClass. In addition, I also want to initialize the instance variable to MyChildClasswhen I do this.
Would do something like this:
+ (id)giveMeAClassUsing:(NSString *)someParameter {
MyChildClass *anInstance = [super giveMeAClassUsing:someParameter];
anInstance.instanceVariable = [[UIImageView alloc] initWithFrame:someFrame];
return anInstance;
}
permissible?
Thank you for your help (in advance) and for resolving my confusion and clarifying some concepts!
Hooray!
source
share