I’ve got two classes: Alpha and Beta.
Beta inherits from Alpha.
How do I write a method in Alpha such that if I call it with an object of class Beta, it will return a new Beta object?
For example:
- (Alpha *)makeAnother {
return [[[self class] alloc] init] autorelease];
}
I thought this would work, but it doesn’t.
Change the return type from
Alpha*toidin this case. The rest of it is right.