Amazon.com Widgets 3 Sections of a Program
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2013, 12:54:50 PM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Chapter Study
| | |-+  Chapter 3 - Classes, Objects, and Methods
| | | |-+  3 Sections of a Program
Pages: [1]   Go Down
Print
Author Topic: 3 Sections of a Program  (Read 425 times)
JackRabbit
Jr. Member
**
Posts: 54



Email




« on: November 27, 2011, 12:44:03 PM »

In chapter 3 it states that programs are logically divided into 3 sections:
1. @interface section
2. @implementation section
3. program section

Why do the first two sections begin with an "@" symbol?

Are all Objective-C programs divided this way?

And are the first  two sections found in what is called a "h. file" or "header file"?


JR
Logged
Fred
Newbie
*
Posts: 46






« Reply #1 on: November 29, 2011, 08:52:03 AM »

JackRabbit,

The @ prefix is just how Objective-C defines the names of the sections.

If all the code was in a single file, you would see that the code would have the three sections listed.  In most cases the code is broken up into multiple files with .h and .m parts.  In this case the separate .h file contains the @interface part.  The matching .m file contains the @implementation part and the main.m file contains the program part.  The #import commands are used to include all the other code files into the main.m file so the compiler sees all the code in a single file providing the three parts described in the book.  This will become clearer as you work through Steve's book.

Hope this helps clarify.

Fred
Logged

Fred
JackRabbit
Jr. Member
**
Posts: 54



Email




« Reply #2 on: November 29, 2011, 07:39:51 PM »

Thank you Fred. It does.

It is like an eMail address but instead of .com it is a file. Sort of.....

JR
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.