O'Reilly logo

Objective-C Programming: The Big Nerd Ranch Guide by Mikey Ward, 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

15 Objects and Memory

In this chapter, you will learn about the life of objects on the heap and how heap memory is managed.

On pointers and their values

Objects can only be accessed via a pointer, and it is practical, if inaccurate, to refer to an object by its pointer, as in now is an NSDate. However, is important to remember that the pointer and the object that it points at are not the same thing. Here is a more accurate statement: now is a pointer that can hold an address of a location in memory where an instance of NSDate lives.

Create a new Command-line Tool named TimesTwo. Make its type Foundation. In main.m, declare a variable that points to an instance of NSDate.

#​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​ ...

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