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 ...

Get Programming in Objective-C, Sixth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.