• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Abstract base classes in Objective C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abstract base classes in Objective C


  • Subject: Re: Abstract base classes in Objective C
  • From: Chaz McGarvey <email@hidden>
  • Date: Thu, 14 Apr 2005 07:30:34 -0600


On Apr 14, 2005, at 6:18 AM, Ondra Cada wrote:

What I do, and I can't say that this is the norm, is to raise an
exception when I define what I would want to be a purely abstract
method that subclasses must override. Since Objective-C has no such
thing as pure virtual (using C++ lingo) methods, then this, as far as I
can tell, is a good solution.

Quite.

And in a sense, it *is* a perfect norm and *the* way of doing that, only instead the exception use the message which is standard exactly for this:

-(void)publicMethod { // "abstract" method
  [self doesNotRecognizeSelector:_cmd];
}

Nice. I usually raise an exception under this circumstance as well (not really knowing what was the norm either), but I didn't realize there was a standard method that would take care of it. Thanks!


Chaz McGarvey
http://www.brokenzipper.com

_______________________________________________
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


References: 
 >Re: Abstract base classes in Objective C (From: Will Mason <email@hidden>)
 >Re: Abstract base classes in Objective C (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: problem with ichat
  • Next by Date: Custom ruler view for NSTextView?
  • Previous by thread: Re: Abstract base classes in Objective C
  • Next by thread: NSString's drawInRect renders strange
  • Index(es):
    • Date
    • Thread