Re: Instance method declaration
Re: Instance method declaration
- Subject: Re: Instance method declaration
- From: Ryan Britton <email@hidden>
- Date: Sun, 21 May 2006 19:16:17 -0700
The Role of the Interface
The purpose of the interface file is to declare the new class to
other source modules (and to other programmers). It contains all the
information they need to work with the class (programmers might also
appreciate a little documentation).
The interface file tells users how the class is connected into the
inheritance hierarchy and what other classes—inherited or simply
referred to somewhere in the class—are needed.
The interface file also lets the compiler know what instance
variables an object contains, and tells programmers what variables
subclasses inherit. Although instance variables are most naturally
viewed as a matter of the implementation of a class rather than its
interface, they must nevertheless be declared in the interface file.
This is because the compiler must be aware of the structure of an
object where it’s used, not just where it’s defined. As a programmer,
however, you can generally ignore the instance variables of the
classes you use, except when defining a subclass.
Finally, through its list of method declarations, the interface file
lets other modules know what messages can be sent to the class object
and instances of the class. Every method that can be used outside the
class definition is declared in the interface file; methods that are
internal to the class implementation can be omitted.
From http://developer.apple.com/documentation/Cocoa/Conceptual/
ObjectiveC/
You will, however, get warnings for methods that are not declared in
the interface.
On May 21, 2006, at 7:04 PM, Angelo Chen wrote:
Hi,
Is declaration of instance method in the header file optional?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.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
_______________________________________________
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