• 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: Virtual concept in Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Virtual concept in Objective-C


  • Subject: Re: Virtual concept in Objective-C
  • From: Michael Watson <email@hidden>
  • Date: Wed, 19 Jul 2006 14:47:31 -0400

I'm not a big fan of putting the standard methods in the header file, either.

Let's say a co-worker has a class called "FVAwesomeWindow". The header file indicates that it's a subclass of NSWindow. I don't need to see -initWithContentRect:styleMask:backing:defer: and -dealloc in the header file as well. It's an NSWindow subclass, so either those methods exist and are being overridden, they're not being overridden (and still exist, obviously), or there's a different method do whatever (which would then appear in the header file, because it's not a method in the common NSWindow class). E.g.,

- (void)initWithContentRect:(NSRect *) withSomeAttribute:(Something *) foo; // FVAwesomeWindow is a special window is always a panel that floats and has XYZ attributes, but we always want to set SomeAttribute at creation, so this is how we roll.

But if the FVAwesomeWindow just uses the standard NSWindow init methods, there's really no reason to clutter up the header file with that information. We know it's there, it's an NSWindow subclass. The absence of any special custom init method(s) means that it uses the normal init methods.

My thoughts, anyway.


-- Michael Watson

On 19 Jul, 2006, at 14:34, Scott Ribe wrote:

Well, that's a matter of style. Argument 1: all methods implemented should
be declared in the header, so that by looking at the header one can tell
what methods a class implements--in theory I agree. Argument 2:
commonly-overridden methods (think dealloc for instance) just clutter up the
header without providing any real info.

_______________________________________________ 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
  • Follow-Ups:
    • Re: Virtual concept in Objective-C
      • From: Dirk Stegemann <email@hidden>
References: 
 >Re: Virtual concept in Objective-C (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Re: Autoreleasepool problems
  • Next by Date: Re: Re: Re: NSSearchField Categories Menu (bug?!)
  • Previous by thread: Re: Virtual concept in Objective-C
  • Next by thread: Re: Virtual concept in Objective-C
  • Index(es):
    • Date
    • Thread