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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.