Re: Design Paterns: +/- Initializers and Subclassing (Solved)

2009-08-03 Thread Christopher J Kemsley
Oh yeah - I thought I did that once and it didn't work... Though, now that I think about it, I think I did it the other way in the past (used self in a +method to refer to a newly created object) So, in all reality, the +method could be boiled down to: [self.new autorelease] ; since

Re: Design Paterns: +/- Initializers and Subclassing (Solved)

2009-08-03 Thread Kyle Sluder
On Aug 3, 2009, at 1:13 AM, Christopher J Kemsley kd7...@gmail.com wrote: So, in all reality, the +method could be boiled down to: [self.new autorelease] ; This is improper use of the dot syntax. new is not a property, so it should not be accessed using the dot syntax. --Kyle Sluder

Design Paterns: +/- Initializers and Subclassing

2009-08-02 Thread Christopher J Kemsley
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 ]

Re: Design Paterns: +/- Initializers and Subclassing

2009-08-02 Thread Quincey Morris
On Aug 2, 2009, at 22:17, Christopher J Kemsley wrote: 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]) Like this: return [ [ [[self

Re: Design Paterns: +/- Initializers and Subclassing

2009-08-02 Thread Quincey Morris
On Aug 2, 2009, at 22:26, Quincey Morris wrote: return [ [ [[self class] alloc] init ] autorelease ] ; ('self' refers to the class object because this is a class method) Doh, if that's true, then: return [ [ [self alloc] init ] autorelease ] ; should be good enough. (IIRC,