Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimeZone and Abstract Classes



Thanks Simon. You're probably right. I think I have been in denial because of the additional work I'll have to do assuming that NSTimeZone is a class cluster.

So now the question (to you or anyone) becomes "how do I determine what are the primitive methods that I must override in my subclass?" I haven't found where these may be noted in any of the docs. I could find them via trial and error, but I would hope there is a better way.

Joe


On Wednesday, October 31, 2001, at 04:48 AM, Simon Stapleton wrote:

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>)



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.