Re: Are method declarations just comments?
Re: Are method declarations just comments?
- Subject: Re: Are method declarations just comments?
- From: Andreas Monitzer <email@hidden>
- Date: Sun, 8 Jul 2001 11:27:27 +0200
On Sunday, July 8, 2001, at 08:52 , Chris Gehlker wrote:
I'm pretty new to Cocoa, just working my way through "Learning Cocoa" in
fact. I noticed that the book was having me add methods in .m files
without
declaring them in the corresponding .h file and the programs were still
compiling and running w/o warnings. So I went back and commented out
method
declarations and even changed them so they declared the wrong type of
arguments. Again it didn't seem to matter. I'm beginning to fear that
they're just comments. Someone say it isn't so.
It isn't so :-)
Header files are in ObjC (like in C, unlike in C++) just a hint for the
compiler and for the user. You can send every message you like to every
object, but if it's not declared in the header, the compiler will spit out
a warning.
andy
--
Description forthcoming.