when a chunk of memory is obtained from the operating system and desig-
nated as the location that will hold the object’s instance variables. Sending
the alloc message to a class causes that class to allocate a chunk of memory
large enough to hold all its instance variables. alloc also conveniently initial-
izes all the memory to 0. That way, you don’t have the problem of uninitialized
memory causing all sorts of random bugs that afflicts many languages. All
your BOOLs start out as NO; all your ints are 0; all your floats become 0.0; all
your pointers are nil;
string = [[NSString alloc]
initWithContentsOfFile: @"/tmp/words.txt"];
Hiç yorum yok:
Yorum Gönder