O'Reilly logo

Objective-C Programming: The Big Nerd Ranch Guide by Aaron Hillegass

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

17Your First Class

So far, you have only used classes created by Apple. Now you get to write your own class. Remember that a class describes objects in two ways:

  • methods (both instance methods and class methods) implemented by the class

  • instance variables within each instance of the class

You’re going to write a Person class, similar to the struct Person you wrote in Chapter 10. Your class will be defined in two files: Person.h and Person.m. Person.h, known as the header or interface file, will contain the declarations of instance variables and methods. Person.m is known as the implementation file. This is where you write out the steps for, or implement, each method.

Create a new project: a Foundation Command Line Tool named BMITime.

To create a ...

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