Class Logistics, Overview of iOS, MVC, Objective-C - MVC

9 important questions on Class Logistics, Overview of iOS, MVC, Objective-C - MVC

Where do all objects live?

In the heap

How do we keep track what objects are in the heap and what objects need to be cleaned up?

Objective c uses automatic reference counting.

When is an object cleared out of the heap?

When i stop pointing to it, i.e. when i set the pointer to nil, or the pointer points to something else.

  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

What does the keyword weak on a property mean?

 

Keep the object in the heap as long as someone else points strongly to it. When no one points to it, clean it up and set my pointer to nil!

what does @synthesize contents = _contents; mean? (the property name is "contents")

It means the instance variabele for the getter and setter of contents is _contents.

Do properties always start with a lowwer or uppercase letter?

lower case

Do you need to specify strong or weak on primitives?, i.e. BOOL?

No, but you still have to say "nonatomic"

How can you change the name of a "getter" in the header files?

getter=nameOfTheGetter

i.e.

@property(nonatomic, getter=isFaceUp) BOOL faceUp;

Can an array contain object from any class, or must the object be the same class?

They can be any class. 

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo