O'Reilly logo

Programming in Objective-C, Sixth Edition by Stephen G. Kochan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The program Section

The program section contains the code to solve your particular problem, which can be spread out across many files, if necessary. Somewhere you must have a routine called main, as previously noted. That’s where your program always begins execution. Here’s the program section from Program 3.2:

//---- program section ----int main (int argc, char * argv[]){   @autoreleasepool {      Fraction  *myFraction;      // Create an instance of a Fraction and initialize it      myFraction = [Fraction alloc];      myFraction = [myFraction init];      // Set fraction to 1/3      [myFraction setNumerator: 1];      [myFraction setDenominator: 3];      // Display the fraction using the print method      NSLog (@"The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required