| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I've defined ClockieTimeZone as a subclass of NSTimeZone. It's a
pretty minimal implementation, with the intent of adding one
variable and a method or two. Otherwise, I just want the
functionality of NSTimeZone (name, description,
isDaylightSavingsTime, etc.).
Unfortunately, every time I send a ClockieTimeZone instance a
message that includes a selector that's in NSTimeZone, I get an
error in the Console like the one below. I even get these when
initWithName is called. Can anyone tell me what I've obviously
overlooked?
"-name only defined for abstract class. Define -[ClockieTimeZone
name]!"
Well, my guess is that NSTimeZone is actually a class cluster, and
thus you have to implement all of the primitive selectors in your
subclass. Why? Well, the abstract (public) superclass of a cluster
has no (or, possibly, limited) instance variables due to the fact it
knows nothing about the implementation of its subclasses. It cannot,
therefore, provide any meaningful implementation of selectors that
would access such instance variables, hence the error you're seeing.
So, as the error would suggest, you need to define those 'primitive'
selectors in your subclass (-name, in this case[1]).
| References: | |
| >Re: NSTimeZone and Abstract Classes (From: Simon Stapleton <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.