Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Creating classes > Declaring the interface of a class

5.2. Declaring the interface of a class

The interface of a class defines the “public face” of a class—what the class looks like and how it can be interacted with. The interface declaration describes the kind of data the class stores and the various messages you can send it to perform tasks on your behalf. It’s designed to provide enough details for other sections of an application to make use of the class without providing any details on how the class physically achieves its stated capabilities.

The declaration of a new class is signaled by the @interface compiler directive. Everything from this point on, until a matching @end directive, makes up the interface of the class. You may think the use of a directive named @class would make more sense. One way to remember this apparent discrepancy is to realize that your interface must eventually be matched with a suitable implementation, and indeed there is a matching @implementation directive that we cover later in this chapter.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint