Re: Redeclaring overrides
Re: Redeclaring overrides
- Subject: Re: Redeclaring overrides
- From: "David P. Henderson" <email@hidden>
- Date: Sat, 18 Aug 2001 23:23:42 -0400
On Saturday, August 18, 2001, at 02:54 , Chris Gehlker wrote:
>
I can't tell if this is just another "Learning Cocoa" brain fart or if
>
there
>
is some semantic reason for redeclairing these methods analogous to the
>
way
>
that declaring virtual destructors are used in C++ to signal when the
>
class
>
is intended to be abstract. Would somebody please set me straight?
>
There 2 schools of thought that I've seen repeatedly within this
community:
If you are altering the expected behavior of an overridden method,
declare it in the header; otherwise, don't.
For example -dealloc: the expected behavior is to release any
objects which your object allocated during its life. If your -dealloc
changes this you should declare it in the header and document your
deviation from the expected behavior.
Or:
Declare every method in the header.
The Cocoa frameworks appear to follow the first practice.
Dave
--
Chaos Assembly Werks
"The Trend over the last 20 years or so has been to design computer
languages that enforce a state of paranoia. You're expected to program
every module as if it were in a state of siege In Perl culture, by
contrast, you're expected to stay out of someone's home because you
weren't invited in, not because there are bars on the windows."
from Programming Perl