Re: Question about categories
Re: Question about categories
- Subject: Re: Question about categories
- From: "Alan Smith" <email@hidden>
- Date: Sat, 2 Sep 2006 18:19:35 -0400
That is the type of response I want but, not what I wanted to hear ;)
Thanks Andrew.
So, sinse I can't add onto a method... If I subclass it there are
several methods that return an object of its class. That wouldn't do
because then only the first object would have the extra methods that I
add. So... I tried overriding those methods like this:
- (myclass*)methodName
{
return (myclass*)[super methodName];
}
That didn't work, it had a bunch of compiler warnings. For example when I tried:
myclass *object = [self methodName];
it said something like "incompatible value in assignment." Also had an
error like: "previous declaration of methodName." So I gave up on
that.
If you have any suggestions, please tell me, I'd love to hear them.
Peace, Alan
On 9/2/06, Andrew Merenbach <email@hidden> wrote:
Hi, Alan. Sorry to hear about your negative experiences, but anyway,
here's what you'll need to do:
A category *cannot* add onto an existing method; it can only replace
it. If you wish to extend the initializer, you will need to make a
subclass instead.
Hope that this helps. Cheers!
Regards,
Andrew
On 2 Sep 2006, at 14:12, Alan Smith wrote:
> Hi everyone,
>
> I'm making a category on a class and want to add onto the classes
> designated initializer method.
> I tried overriding it but then I can't use something like this:
>
> if (self = [self init...)
>
> Because that would create an endless loop.
>
> My guess is that this is "basic" and that all of you will flip out on
> me, saying I should RTFM or that I lack the basic knowledge and would
> "benefit" from reading up on my Obj-C. Well, if I knew where to look
> for the answer to this I wouldn't be asking here and, isn't the point
> of this list to get help?
>
> I apologize for that but I had to get it out of my system, I've had
> some bad experiences here recently.
> Peace, Alan
> --
> // Quotes from yours truly -------------------------
> "You don't forget, you just don't remember."
> "Maturity resides in the mind."
> "Silence is the Universe's greatest gift."
> "Don't waste your life doing things others have already done."
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> 40ucla.edu
>
> This email sent to email@hidden
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden