Re: Virtual concept in Objective-C
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