Ok, so here's the deal:

I have a class (CYMethod) that provides a standard interface for multiple implementations of the same type (multiple ways in which to read a file, for instance). Here are its constructors:


+ (CYMethod*)           method {
        return [ [ [CYMethod alloc] init ] autorelease ] ;
}
- (CYMethod*)           init {
        if ( self = [super init] )
                {
                        
                }
        return self ;
}


What I want to be able to do is subclass this, but only override the - init method. However, if I use the above code and call

[CYMethodSubclass method]

I'll get back a new instance of CYMethod, not CYMethodSubclass.


How do I make the +method call return an initialized object of whatever type the +method was sent to? (so that [CYMethodSubclass method] returns [ [ [CYMethodSubclass alloc] init ] autorelease])


Thanks,
-Christopher
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to